Results 1 to 2 of 2
  1. #1
    Joined
    Jan 2004
    Location
    My Own Mind
    Age
    53
    Posts
    1,545

    Truncate URLs using PHP

    Quick question while my code guys are busy.

    What do I need to do to this.
    Code:
    <?php echo $feed['url'] ?>
    to make the resulting URL that looks like this
    Code:
    http://www.joomla.org/index.php?option=com_rss_xtd&feed=rss2.0&type=com_frontpage&itemid=1
    half as short?

    I would like it to go one better and make the URL a hyperlink but not really necessary.

    I'm Googling right now and am hoping to find the answer but I'm not a programmer on any level so most of the stuff I've seen I don't know how to implement.
    Ebay---Heatware---Paypal verified---Project:Geared Up---My Site-ROSSWERKZ.COM

  2. #2
    Joined
    Oct 2001
    Location
    Southern Ontario
    Age
    45
    Posts
    13,194

    Re: Truncate URLs using PHP

    I've read this post a few times, and never quite figured out what you were asking. By now you've probably either figured out your answer or abandoned this altogether, but either way I think I finally understand what you're asking.

    So when you have that piece of code that must be a portion of a larger application, it will spit out that long and ugly URL onto the webpage. You'd rather it be small and simple. What you're looking for isn't a PHP command. You're really looking for some simple HTML code. Here try this:

    PHP Code:
    <a href=<?php echo $feed['url'?> >Small Link</a>
    What that does is changes the displayed link to read 'Small Link' instead of the actual long URL. You can change the words 'Small Link' to say anything appropriate for your task.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •