Author Topic: {cat_id} changes each pageload  (Read 5504 times)

0 Members and 1 Guest are viewing this topic.

Offline Jasondavis

  • Full Member
  • ***
  • Posts: 157
    • View Profile
{cat_id} changes each pageload
« on: July 06, 2005, 10:50:12 PM »
{cat_id} changes in my template each page reload if a category has 0 images, it's complicated why I need this done but is there any way around this?

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: {cat_id} changes each pageload
« Reply #1 on: July 07, 2005, 01:26:05 AM »
what template? what are u trying to do? sounds like the {cat_id} is being used from random image...
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 Jasondavis

  • Full Member
  • ***
  • Posts: 157
    • View Profile
Re: {cat_id} changes each pageload
« Reply #2 on: July 07, 2005, 03:54:36 AM »
This is in my category.html template, I have category comments so if the category has 0 images in it each page load it is wanting to load a different {cat_id} in my comment area which results in it showing comments from other categories

Offline Jasondavis

  • Full Member
  • ***
  • Posts: 157
    • View Profile
Re: {cat_id} changes each pageload
« Reply #3 on: July 07, 2005, 04:01:17 AM »
 {self} would almost work but it shows cat_id=categories.php?cat_id=347 and I need it show cat_id=categories2.php?cat_id=347









Offline Phedo

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: {cat_id} changes each pageload
« Reply #4 on: December 04, 2006, 07:31:14 PM »
I do not know if this problem is solved, but I had the same I find a solution by myself.

I added in categories.php around line 73:

$site_template->register_vars(array(
  "categories" => get_categories($cat_id),
  "cat_name" => format_text($cat_cache[$cat_id]['cat_name'], 2),
[...]

  "random_cat_image" => $random_cat_image

this at the end:

,"title" => $_GET[cat_id]

That's the trick. In my template I call {title} to get the cat-ID without being overwritten from random image.

I hope, there will be a solution in some next version of 4images so that you could use the catid without changing the code.

Phedo.