Long URL for articles break the look

AlexisWilke - December 5, 2008 - 20:21
Project:Aggregation
Version:6.x-1.3
Component:User interface
Category:bug report
Priority:minor
Assigned:Unassigned
Status:active
Description

Hi guys,

I have a neat website with the body (content) of the page in a narrow (about 500px) area. The problem is that some feeds offer news URLs that are at length (with some large random identifier).

I have an image attached so you can see the result.

What I have done to fix the problem, at this time, is copy the aggregator source template PHP file and fix the print $source_url; to make sure that over a certain size the URL is cut. (like with the _filter_trim() function)

What I think would be neat is to add a way to define the maximum length (like with the URL filters) and give the aggregator source template another variable called $caption that we could use as the URL caption.

<?php
 
<div class="feed-url">
    <
em>??php print t('URL:'); ??</em> <a href="??php print $source_url; ??">
    ??
php
     
if (strlen($source_url) > 55) {
        echo
substr($source_url, 0, 55), "...";
      }
      else {
        print
$source_url;
      }
    ??
    </
a>
  </
div>
?>

And if the module was to offer a $caption, the condition would simply become print $caption.

Thank you.
Alexis Wilke

AttachmentSize
Google-URL.png377.99 KB
 
 

Drupal is a registered trademark of Dries Buytaert.