4images Forum & Community
4images Issues / Ausgaben => Discussion & Troubleshooting => Topic started by: marod0er on April 07, 2006, 02:07:16 PM
-
Hello.
I'm trying to get 4images to display both the thumb, image name and category description on the frontpage. All those 3 variables should be displayed in every {thumbnail} (every new image).
I can get thumbnail and image name to show, by doing this in functions.php:
if ($show_link) {
if ($open_window) {
$thumb = "<div class=\"thumb1\"><a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&mode=".$mode : ""))."\" onclick=\"opendetailwindow()\" target=\"detailwindow\">".$thumb."</a></div><div class=\"thumb2\"><a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&mode=".$mode : ""))."\" title=\"".$image_name."\">".$image_name."</a><br />".$cat_description."</div>";
}
else {
$thumb = "<div class=\"thumb1\"><a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&mode=".$mode : ""))."\">".$thumb."</a></div><div class=\"thumb2\"><a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&mode=".$mode : ""))."\" title=\"".$image_name."\">".$image_name."</a><br />".$cat_description."</div>";
}
}
Marked with red is what I can't get to work. How do I get this to function?
Any help is greatly appreciated, as I've been trying to figure this out for hours... :?
-
use $cat_cache[$cat_id]['cat_description'] (and dont forget add global $cat_cache; on top of the function ;)
-
use $cat_cache[$cat_id]['cat_description'] (and dont forget add global $cat_cache; on top of the function ;)
Hey man,
Care to elaborate? I've tried adding $cat_cache to what I thought was the top of the function, like this:
global $site_sess, $config, $cat_cache;
But that didn't work...
My code now looks like this:
if ($show_link) {
if ($open_window) {
$thumb = "<div class=\"thumb1\"><a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&mode=".$mode : ""))."\" onclick=\"opendetailwindow()\" target=\"detailwindow\">".$thumb."</a></div><div class=\"thumb2\"><a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&mode=".$mode : ""))."\" title=\"".$image_name."\">".$image_name."</a><br />$cat_cache[$cat_id]['cat_description']</div>";
}
else {
$thumb = "<div class=\"thumb1\"><a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&mode=".$mode : ""))."\">".$thumb."</a></div><div class=\"thumb2\"><a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&mode=".$mode : ""))."\" title=\"".$image_name."\">".$image_name."</a><br />$cat_cache[$cat_id]['cat_description']</div>";
}
}
-
perhaps if you would replace $cat_description variable only, it would work (you removed ". ." around it as well)
-
I'm not quite sure what you mean, could you show me with a code example? Please
-
Please Vano... :P
-
[qcode] if ($show_link) {
if ($open_window) {
$thumb = "<div class=\"thumb1\"><a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&mode=".$mode : ""))."\" onclick=\"opendetailwindow()\" target=\"detailwindow\">".$thumb."</a></div><div class=\"thumb2\"><a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&mode=".$mode : ""))."\" title=\"".$image_name."\">".$image_name."</a><br />".$cat_cache[$cat_id]['cat_description']."</div>";
}
else {
$thumb = "<div class=\"thumb1\"><a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&mode=".$mode : ""))."\">".$thumb."</a></div><div class=\"thumb2\"><a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&mode=".$mode : ""))."\" title=\"".$image_name."\">".$image_name."</a><br />".$cat_cache[$cat_id]['cat_description']."</div>";
}
}
[/qcode]
-
Vano:
Yes, I've already tried entering ".$cat_cache[$cat_id]['cat_description']."
Without any luck. Could you post how I should enter the global thing you mentioned before?
Thanks a lot
-
Could you please tell me what you meant with the global thing?
-
I finally figured it out.
Decided I would rather have the image description, so I just added $image_row in the global function and then this
".$image_row['image_description']."
where i wanted the description to show. Works like a charm. Problem solved :)