Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

requaler exp question modification

  • 07-04-2011 7:36am
    #1
    Registered Users, Registered Users 2 Posts: 648 ✭✭✭


    Hi there,

    the below function maked links out of urls in a piece of text.

    however i dont want it to make links out of image urls

    i put in image urls in my text like this {img}IMAGE_URL{/img}

    how would i edit the below please so it ignores everything in the {img tags}?
    tnx


    [PHP]
    function makeClickableLinks($text) {



    $text = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)',

    '<a href="\\1" target="_blank">\\1</a>', $text);

    $text = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&//=]+)',

    '\\1<a href="http://\\2">\\2</a>', $text);

    $text = eregi_replace('([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3})',

    '<a href="mailto:\\1">\\1</a>', $text);



    return $text;



    }
    [/PHP]


Comments

  • Registered Users, Registered Users 2 Posts: 105 ✭✭damoth


    Are all other types of URLs surrounded by something like {...} too in the same way as image URLS are surrounded by {img}? In other words, what tags surround URLS you do want to modify?

    I think it would be easier to make the reg exp only include the other tags you want rather that omit image tags you don't want.


Advertisement