Author Topic: [MOD] Adding {ifno tagname1}{tagname2}{endifno tagname1} v1.7/v1.7.1  (Read 28422 times)

0 Members and 1 Guest are viewing this topic.

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
This little extra feature will let u use those kind of tags in templates:
{ifno tagname1}
 {tagname2}
 or page content
{endifno tagname1}

What does it mean?
It will display whatever is registered in {tagname2} if {tagname1} is empty or set as 0
the format is the same as {if tagname}{tagname} or whatever else{endif tagname} but works opposite

For 4images v1.7

Open /includes/template.php
Find:
Code: [Select]
 function replace_if($template) {
    foreach ($this->key_cache as $key => $val) {
      if (empty($this->val_cache[$key]) || $this->val_cache[$key] == REPLACE_EMPTY) {
        $reg = "/".$this->start."if[ \t\r\n]+".$key.$this->end."(.*)".$this->start."endif[ \t\r\n]+".$key.$this->end."/siU";
        $template = preg_replace($reg, "", $template);
      }
    }
    return $template;
  }
Add after:
Code: [Select]
 function replace_ifno($template) {
    foreach ($this->key_cache as $key => $val) {
      if (!empty($this->val_cache[$key]) && $this->val_cache[$key] != REPLACE_EMPTY) {
        $reg = "/".$this->start."ifno[ \t\r\n]+".$key.$this->end."(.*)".$this->start."endifno[ \t\r\n]+".$key.$this->end."/siU";
        $template = preg_replace($reg, "", $template);
      }
    }
    return $template;
  }


Find:
Code: [Select]
   $template = $this->replace_if ($template);Add after:
Code: [Select]
   $template = $this->replace_ifno ($template);
Find:
Code: [Select]
     "/".$this->start."endif[ \t\r\n]+[^ \t\r\n".$this->end."]+".$this->end."/",Add after:
Code: [Select]
     "/".$this->start."ifno[ \t\r\n]+[^ \t\r\n".$this->end."]+".$this->end."/",
      "/".$this->start."endifno[ \t\r\n]+[^ \t\r\n".$this->end."]+".$this->end."/",

Find:
Code: [Select]
   $replace_array = array(Add after, those two lines:
Code: [Select]
     "",
      "",


For 4images v1.7.1
Please apply [1.7.1] Conditional tags inside other conditional tags + {ifno ...}{endifno ...} bug fix, which includes {ifno..} feature:
« Last Edit: April 22, 2005, 02:39:23 AM by V@no »
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 widgit1981

  • Jr. Member
  • **
  • Posts: 98
    • View Profile
[EXTRA] Adding {ifno tagname1}{tagname2}{endifno tagname1}
« Reply #1 on: June 04, 2003, 02:15:09 PM »
Tried it and got:

Fatal error: Call to undefined function: replace_ifno() in /*****/*****/*****/includes/template.php on line 128

Also do I just put the content if no thumbnails in {tag2} in categories.html say:

{ifno tag1}
Content here
{endifno tag1}

Line 128 is:
    $template = $this->replace_ifno ($template);

Thanks

Steve

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
[EXTRA] Adding {ifno tagname1}{tagname2}{endifno tagname1}
« Reply #2 on: June 04, 2003, 02:24:08 PM »
ops, sry about that...I first make it as {ifnot...} then after posting, edited...
delete t in this line:
function replace_ifnot($template) {

P.S. I corrected the post.
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 widgit1981

  • Jr. Member
  • **
  • Posts: 98
    • View Profile
[EXTRA] Adding {ifno tagname1}{tagname2}{endifno tagname1}
« Reply #3 on: June 04, 2003, 02:31:13 PM »
Thanks I just noticed it before you posted.

Might be worth to mention to make it work you need to change tag1 into something say:

{ifno thumbnails}
Content here
{endifno thumbnails}

To say if no thumbnails are in the category show "content here" I know I got a little confused.

Thanks

Steve

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
[EXTRA] Adding {ifno tagname1}{tagname2}{endifno tagname1}
« Reply #4 on: June 04, 2003, 02:34:20 PM »
it works exactly the same as {if tagname}
just replace tag1 with name of your tag.
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 widgit1981

  • Jr. Member
  • **
  • Posts: 98
    • View Profile
[EXTRA] Adding {ifno tagname1}{tagname2}{endifno tagname1}
« Reply #5 on: June 04, 2003, 02:37:14 PM »
Thanks

I just discovered it myself and was editing my post while you where writing your post lol

Thanks again you wouldn't believe how much this has helped. Will this thread become sticky cuz I think a few people would like to know this.

Steve

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
[EXTRA] Adding {ifno tagname1}{tagname2}{endifno tagname1}
« Reply #6 on: June 04, 2003, 02:40:17 PM »
I didnt want make it sticky, because it's actualy for little more "advanced" ppl ;) (not everyone out there even knows what {...} means :?)
but if u guys think it worth to be sticky, then be it ;)
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 widgit1981

  • Jr. Member
  • **
  • Posts: 98
    • View Profile
[EXTRA] Adding {ifno tagname1}{tagname2}{endifno tagname1}
« Reply #7 on: June 04, 2003, 02:53:45 PM »
Ohhh I am in the advanced class ??? LOL

We'll see if anyone replies to the post and see if they want it to be.

Thanks again.

Steve :)

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
[EXTRA] Adding {ifno tagname1}{tagname2}{endifno tagname1}
« Reply #8 on: June 04, 2003, 05:37:18 PM »
Go ahead, make it sticky.

Offline police22

  • Jr. Member
  • **
  • Posts: 70
    • View Profile
    • The Dartez Page
Re: [EXTRA] Adding {ifno tagname1}{tagname2}{endifno tagname1}
« Reply #9 on: April 22, 2005, 12:45:46 AM »
V@no.. i know this is an old thread but is this already intergrated in 1.7.1 cause could not find it in the template.php.
also is this what i need.. im trying to figure out a way to make the Photo of the day and the random image to not show up when you go in to a category. right now i have potd and ri in the header.. is there a better way to do this?.. i did search to see but couldnt find much info..
Thanks,

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: [MOD] Adding {ifno tagname1}{tagname2}{endifno tagname1} v1.7/v1.7.1
« Reply #10 on: April 22, 2005, 02:40:15 AM »
I've updated the original post.
Here is for v1.7.1
http://www.4homepages.de/forum/index.php?topic=7493.0
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 wallward

  • Jr. Member
  • **
  • Posts: 54
    • View Profile
Re: [MOD] Adding {ifno tagname1}{tagname2}{endifno tagname1} v1.7/v1.7.1
« Reply #11 on: December 30, 2013, 07:11:57 PM »

not work in 1.7.10 and 11
please help me man.
please check my templates.php
i apply "[MOD] Treat bots as users with less rights"
but {ifno is_bot} not work

Rembrandt

  • Guest
Re: [MOD] Adding {ifno tagname1}{tagname2}{endifno tagname1} v1.7/v1.7.1
« Reply #12 on: December 31, 2013, 05:49:40 AM »
Hi!

not work in 1.7.10 and 11
....
Since version 1.7.2 this modification is no longer necessary

mfg Andi