4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: V@no on June 04, 2003, 01:54:28 PM

Title: [MOD] Adding {ifno tagname1}{tagname2}{endifno tagname1} v1.7/v1.7.1
Post by: V@no on June 04, 2003, 01:54:28 PM
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 ...} (http://www.4homepages.de/forum/index.php?topic=7493.0) bug fix, which includes {ifno..} feature:
Title: [EXTRA] Adding {ifno tagname1}{tagname2}{endifno tagname1}
Post by: widgit1981 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
Title: [EXTRA] Adding {ifno tagname1}{tagname2}{endifno tagname1}
Post by: V@no 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.
Title: [EXTRA] Adding {ifno tagname1}{tagname2}{endifno tagname1}
Post by: widgit1981 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
Title: [EXTRA] Adding {ifno tagname1}{tagname2}{endifno tagname1}
Post by: V@no on June 04, 2003, 02:34:20 PM
it works exactly the same as {if tagname}
just replace tag1 with name of your tag.
Title: [EXTRA] Adding {ifno tagname1}{tagname2}{endifno tagname1}
Post by: widgit1981 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
Title: [EXTRA] Adding {ifno tagname1}{tagname2}{endifno tagname1}
Post by: V@no 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 ;)
Title: [EXTRA] Adding {ifno tagname1}{tagname2}{endifno tagname1}
Post by: widgit1981 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 :)
Title: [EXTRA] Adding {ifno tagname1}{tagname2}{endifno tagname1}
Post by: Chris on June 04, 2003, 05:37:18 PM
Go ahead, make it sticky.
Title: Re: [EXTRA] Adding {ifno tagname1}{tagname2}{endifno tagname1}
Post by: police22 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,
Title: Re: [MOD] Adding {ifno tagname1}{tagname2}{endifno tagname1} v1.7/v1.7.1
Post by: V@no 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
Title: Re: [MOD] Adding {ifno tagname1}{tagname2}{endifno tagname1} v1.7/v1.7.1
Post by: wallward 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
Title: Re: [MOD] Adding {ifno tagname1}{tagname2}{endifno tagname1} v1.7/v1.7.1
Post by: Rembrandt 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