logo
WSN Links PHP Directory Software
Features Showcase Reviews Demos Purchase Manual Support
 

"substr" and "ereg_replace"

Version:


"substr" and "ereg_replace"
piskedi
Member

Usergroup: Member
Joined: Oct 17, 2004
Total Topics: 13
Total Posts: 44
Posted 11/06/04 - 02:35 PM:
quote post
#1
On the main page, I display many URLs and link titles. When a long title is used for a site, it pushes the table border away, so the page gets messed up. On the other side, when the title is the same as the URL, the too many repeating "http://www..." statements take too much space. I'd like to shorten the titles and omit the "http://". Now, if I were to use plain php code,

$title2 = ereg_replace("http://", "", $title);
if(strlen($title) > 20) {
$title2 = substr($title,0,20);
$title2 .= "..";

would do the job. But in WSN I have {LINKTITLE} and don't know how to shorten the title or omit "http://".

How can I do this?

(Is there a full list of the WSN variables with basic explanations? Sometimes I can't figure out which variable should be used for a certain purpose. For example, there's a variable for "Site last updatedATE", but I need a variable to display the update hour, because I plan to use a static index page.What sholud be the var.?)
Paul
Administrator
Avatar

Usergroup: Administrator
Joined: Dec 21, 2001
Location: Northern California
Total Topics: 55
Total Posts: 5703
Posted 11/07/04 - 02:45 AM:
quote post
#2
To eliminate http://, see the manual entry on link template variables. I believe it was baseurl.

To shorten the title, does {LINKTITLE[20]} work to set a max length of 20? Might only work for dscriptions.
piskedi
Member

Usergroup: Member
Joined: Oct 17, 2004
Total Topics: 13
Total Posts: 44
Posted 11/07/04 - 01:22 PM:
quote post
#3
Yes, {LINKBASEURL[nohttp]} omits "http://", but a "_" appears after the url this time..(....com_) I had a look at the function in classes/onelink.php, but couldn't figure out why. But it's ok, I can use titles instead of URLs on the main page, so there will be no need to deal with this variable.

{LINKTITLE[20]} shortens the title, but I need a small change on this function about the lengths of trimmed part,the displayed part and the "..." at the end of the shortened title. But I can't find where it is.

Where is this shortening function placed?
(I had a look in "onelink.php", but couldn't see it)

Edited by piskedi on 11/07/04 - 01:25 PM
Paul
Administrator
Avatar

Usergroup: Administrator
Joined: Dec 21, 2001
Location: Northern California
Total Topics: 55
Total Posts: 5703
Posted 11/09/04 - 12:50 AM:
quote post
#4
The function is title. The ... is the language item "cutoff".
Search thread for
Download thread as


You don't have permission to post.

Please login or register.

Admin Control Panel

   
Home    |    Features    |    Showcase    |    Reviews    |    Demos    |    Purchase    |    Manual    |    Support
© 2008 Paul Knierim. All rights reserved.