Posted on: 04/16/03 04:52pm
By: 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!
Graphics as links in Blocks
Posted on: 04/16/03 09:25pm
By: rawdata
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.
Graphics as links in Blocks
Posted on: 04/17/03 12:49pm
By: Anonymous (brispy5)
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.
Graphics as links in Blocks
Posted on: 04/17/03 12:51pm
By: Anonymous (brispy5)
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?
Graphics as links in Blocks
Posted on: 04/17/03 03:30pm
By: rawdata
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.