PEAR Forum :: PHP Extension and Application Repository

PEAR Forum Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Embedded URL in My SQL using pear dataGrid

 
Post new topic   Reply to topic    PEAR Forum Forum Index -> PEAR
View previous topic :: View next topic  
Author Message
johnj46



Joined: 14 Mar 2010
Posts: 3

PostPosted: Sun Mar 14, 2010 4:10 pm    Post subject: Embedded URL in My SQL using pear dataGrid Reply with quote

I use Pear DataGrid to display information from a MYSQL database and it works very well. Now I need to show an embedded link from one of the fields. Normally I would use ereg_replace and wrap the link in the appropriate codes but what is the correct syntax to recover this hypertext and where should it be placed please? I have tried
'flieldname'=> eregi_replace(
'\[L=([&-_./a-zA-Z0-9|!%#?+,\'=:~]+)]'.
'([&-_./a-zA-Z0-9|!%#?+$,\'"=:;~]+)\[EL]',
'<a href="\\1">\\2</a>','fieldname'), in the $columns array and although the page doesn't crash, it does not display the link as an active link.

Would appreciate any guidance you can give me.

Thanks.
Back to top
View user's profile Send private message
mark



Joined: 07 Jan 2007
Posts: 1235

PostPosted: Sun Mar 14, 2010 7:44 pm    Post subject: Reply with quote

Please refer to this manual page:
http://pear.php.net/manual/en/package.structures.structures-datagrid.formatter.php

If you have further questions on this topic, don't hesitate to ask.

BTW, the ereg_* function won't be available in PHP 6. Using preg_* is recommended.
Back to top
View user's profile Send private message
johnj46



Joined: 14 Mar 2010
Posts: 3

PostPosted: Mon Mar 15, 2010 11:30 am    Post subject: Reply with quote

Thanks Mark. I use the callback function for another column which only has a link in it (no other text) but I now need to show a link to a photograph within the text, as you would in an html page, to avoid having a separate column for "photographs". Maybe it is just easier to have the extra column?
Thanks for the advice about preg_

John.
Back to top
View user's profile Send private message
mark



Joined: 07 Jan 2007
Posts: 1235

PostPosted: Mon Mar 15, 2010 11:43 pm    Post subject: Reply with quote

John, maybe I'm not getting your idea, but I guess that you have e.g. a column value like "A B C" and that you want to be "B" a link? That would be possible with a colum formatter function.

If you want something else, please try to explain it in another way, thanks.
Back to top
View user's profile Send private message
johnj46



Joined: 14 Mar 2010
Posts: 3

PostPosted: Tue Mar 16, 2010 2:59 pm    Post subject: Reply with quote

Yes that is right Mark. Basically a description like "Here I am on the beach [photo] getting a tan. Where [photo] would be a hyperlink to the photo. I agree I should be able to do it with a column formatter function. I will give it a try.
Thanks again for your help.

John.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    PEAR Forum Forum Index -> PEAR All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



PEAR Forum topic RSS feed 
Powered by phpBB © 2001, 2005 phpBB Group

Provided by Ministry of Web developement