Author Topic: ".$image_name." in includes/functions.php  (Read 14153 times)

0 Members and 1 Guest are viewing this topic.

Offline marod0er

  • Full Member
  • ***
  • Posts: 199
    • View Profile
".$image_name." in includes/functions.php
« 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...  :?
Greetz: Lasse

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: ".$image_name." in includes/functions.php
« Reply #1 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 ;)
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline marod0er

  • Full Member
  • ***
  • Posts: 199
    • View Profile
Re: ".$image_name." in includes/functions.php
« Reply #2 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>";
    }
  }
Greetz: Lasse

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: ".$image_name." in includes/functions.php
« Reply #3 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)
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline marod0er

  • Full Member
  • ***
  • Posts: 199
    • View Profile
Re: ".$image_name." in includes/functions.php
« Reply #4 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
Greetz: Lasse

Offline marod0er

  • Full Member
  • ***
  • Posts: 199
    • View Profile
Re: ".$image_name." in includes/functions.php
« Reply #5 on: April 10, 2006, 01:23:12 PM »
Please Vano...  :P
Greetz: Lasse

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: ".$image_name." in includes/functions.php
« Reply #6 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]
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline marod0er

  • Full Member
  • ***
  • Posts: 199
    • View Profile
Re: ".$image_name." in includes/functions.php
« Reply #7 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
Greetz: Lasse

Offline marod0er

  • Full Member
  • ***
  • Posts: 199
    • View Profile
Re: ".$image_name." in includes/functions.php
« Reply #8 on: April 15, 2006, 02:11:52 PM »
Could you please tell me what you meant with the global thing?
Greetz: Lasse

Offline marod0er

  • Full Member
  • ***
  • Posts: 199
    • View Profile
Re: ".$image_name." in includes/functions.php
« Reply #9 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 :)
Greetz: Lasse