January 4th, 2008phpLD Better Display URL
Most phpLD templates show the url of the listing along with the title and description. In the default template it looks like this:
rakCha Directory - http://www.rakcha.com/ rakCha premium directory. - [Read more]
This is fine when the url is the domain name. However listings may link to internal pages and the url can be very long and it is no longer convenient to show the whole url. Example:
Painting Directory - http://www.enquira.com/arts-humanities/painting/ enQuira paintings links and resources. - [Read more]
Sometimes the internal link is even longer than this and can include many parameters and can break the template. The proposed solution is to always display only the main url in the display url field, like this:
Painting Directory - http://www.enquira.com enQuira paintings links and resources. - [Read more]
To implement this you should replace
<span class="url">- {$link.URL|escape|trim}
BY
<span class="url">-
{assign var="parsed_url" value=$link.URL|escape|trim|parse_url}
{$parsed_url.host}
in link.tpl
Make sure NOT to replace the instance of {$link.URL|escape|trim} in the actual URL (href=”{$link.URL|escape|trim}”)
Also, in some templates the featured links are implemented in a separate file (like flink.tpl), you should do the same thing in that file.
5 Responses to “phpLD Better Display URL”
Leave a Reply
You must be logged in to post a comment.


January 6th, 2008 at 3:50 pm
Another solution suggested by humm in DP is to truncate the url if the length exceed a certain number of characters, say 30. To do this you need to replace
{$link.URL|escape|trim}
by
{$link.URL|escape|trim|substr:0:30}
February 16th, 2008 at 11:11 pm
Yet another way:
{$link.URL|escape|truncate:50:”…”}
February 28th, 2008 at 3:10 pm
very nice.
thanks for sharing your ideas
August 21st, 2009 at 9:41 am
gylybavyhe…
Fta Satetlite Free Bin Downloads …
September 24th, 2009 at 7:30 am
onegomeci…
michelle tucker pictures …