Welcome to Geeklog, Anonymous Friday, April 19 2024 @ 04:46 am EDT

Geeklog Forums

Graphics as links in Blocks


Anonymous

Anonymous
Greetings all amazing Geeklog developers! Here's my question /problem. I wish to replace the text based links generated by GL in the blocks (for instance- Sections) with a graphical element.. A pretty gif for example. Can I do this? If so, how? I know that GL populates the page with text entered into the block using php etc... But is there a way to customise this as I mentioned above? Any and all help would be much appreciated. Here's the site I've been working on. Got phpAdsnew to generate pop ups and such "integrated" into it and now want to see if I can pretty things up some. http://www.brispy.com/weblog/index.php GL rocks!
 Quote

Status: offline

rawdata

Forum User
Full Member
Registered: 02/17/03
Posts: 236
You can replace the text links with images by hacking up these two lines in the function COM_showTopics in lib-common.php. $retval .= stripslashes( $A['topic'] ); $retval .= '<a href="' . $_CONF['site_url'] . '/index.php?topic=' . $A['tid'] . '"><b>' . stripslashes( $A['topic'] ) . '</b></a> '; If you name the graphics the same name as the topic ids and use the same extensions for each, something like this should work. $retval .= '<img src="' . $_CONF['layout_url'] . '/images/' . $A['tid'] . '.jpg" height="18" width="18" alt="' . stripslashes($A['topic']) . '" title="' . stripslashes($A['topic']) . '">'; You can put the topic name in the alt and title attributes if you eliminate the text. If you want to name your graphics different than the topics and/or use different extentions for each then you'll need like a switch or if/else if statement instead.
 Quote

brispy5

Anonymous
Thanks so much for the help. I got the graphis to be displayed, but can't make them links rather than the text. I'm relatively new to PHP but am learning alot as I go.... I presume I need to plug a GL variable into the alt field or something as you said but am a bit ignorant as to what I appreciate the help.
 Quote

brispy5

Anonymous
Here is the hack as it currnetly stands... $retval .= '<img src="' . $_CONF['layout_url'] . '/images/' . $A['tid'] . '.gif" height="20" width="150" alt="' . stripslashes($A['topic']) . '" title="' . stripslashes($A['topic']) . '">'; $retval .= '<a href="' . $_CONF['site_url'] . '/index.php?topic=' . $A['tid'] . '"><b>' . stripslashes( $A['topic'] ) . '</b></a> '; Any ideas?
 Quote

Status: offline

rawdata

Forum User
Full Member
Registered: 02/17/03
Posts: 236
Sorry, I should have posted that you needed to add the <a> tag around the <img> one for a clickable link. If you want the person to be taken to the topic section just like they would by clicking on the text, it would look like this: $retval .= '<a href="' . $_CONF['site_url'] . '/index.php?topic=' . $A['tid'] . '"><img src="' . $_CONF['layout_url'] . '/images/' . $A['tid'] . '.jpg" height="18" width="18" alt="' . stripslashes($A['topic']) . '" title="' . stripslashes($A['topic']) . '"></a>'; $_CONF['site_url'] -> your site's URL, set in config.php $A['tid'] -> topic id, pulled from the database $_CONF['layout_url'] -> path to your layout directory, set in config.php $A['topic'] -> name of the topic, pulled from the database Best way to learn php is by getting your hands dirty. These CMS' are great teachers. It takes awhile, but you'll get it. Shoot I'm still learning myself.
 Quote

All times are EDT. The time is now 04:46 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content