4images Forum & Community

4images Issues / Ausgaben => Discussion & Troubleshooting => Topic started by: marod0er on April 07, 2006, 02:07:16 PM

Title: ".$image_name." in includes/functions.php
Post 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:

Quote
  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)) ? "&amp;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)) ? "&amp;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)) ? "&amp;mode=".$mode : ""))."\">".$thumb."</a></div><div class=\"thumb2\"><a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&amp;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...  :?
Title: Re: ".$image_name." in includes/functions.php
Post by: V@no on April 07, 2006, 02:41:05 PM
use $cat_cache[$cat_id]['cat_description'] (and dont forget add global $cat_cache; on top of the function ;)
Title: Re: ".$image_name." in includes/functions.php
Post by: marod0er on April 07, 2006, 05:18:58 PM
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:
Quote
  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)) ? "&amp;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)) ? "&amp;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)) ? "&amp;mode=".$mode : ""))."\">".$thumb."</a></div><div class=\"thumb2\"><a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&amp;mode=".$mode : ""))."\" title=\"".$image_name."\">".$image_name."</a><br />$cat_cache[$cat_id]['cat_description']</div>";
    }
  }
Title: Re: ".$image_name." in includes/functions.php
Post by: V@no on April 08, 2006, 12:30:26 AM
perhaps if you would replace $cat_description variable only, it would work (you removed ". ." around it as well)
Title: Re: ".$image_name." in includes/functions.php
Post by: marod0er on April 08, 2006, 12:01:44 PM
I'm not quite sure what you mean, could you show me with a code example? Please
Title: Re: ".$image_name." in includes/functions.php
Post by: marod0er on April 10, 2006, 01:23:12 PM
Please Vano...  :P
Title: Re: ".$image_name." in includes/functions.php
Post by: V@no on April 11, 2006, 03:17:37 AM
[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)) ? "&amp;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)) ? "&amp;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)) ? "&amp;mode=".$mode : ""))."\">".$thumb."</a></div><div class=\"thumb2\"><a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&amp;mode=".$mode : ""))."\" title=\"".$image_name."\">".$image_name."</a><br />".$cat_cache[$cat_id]['cat_description']."</div>";
    }
  }
[/qcode]
Title: Re: ".$image_name." in includes/functions.php
Post by: marod0er on April 11, 2006, 01:08:10 PM
Vano:

Yes, I've already tried entering
Code: [Select]
".$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
Title: Re: ".$image_name." in includes/functions.php
Post by: marod0er on April 15, 2006, 02:11:52 PM
Could you please tell me what you meant with the global thing?
Title: Re: ".$image_name." in includes/functions.php
Post by: marod0er on June 07, 2006, 12:26:00 PM
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
Code: [Select]
".$image_row['image_description']."where i wanted the description to show. Works like a charm. Problem solved :)