4images Forum & Community
4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started 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: 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: 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: $template = $this->replace_if ($template);
Add after: $template = $this->replace_ifno ($template);
Find: "/".$this->start."endif[ \t\r\n]+[^ \t\r\n".$this->end."]+".$this->end."/",
Add after: "/".$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: $replace_array = array(
Add after, those two lines: "",
"",
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:
-
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
-
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.
-
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
-
it works exactly the same as {if tagname}
just replace tag1 with name of your tag.
-
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
-
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 ;)
-
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 :)
-
Go ahead, make it sticky.
-
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,
-
I've updated the original post.
Here is for v1.7.1
http://www.4homepages.de/forum/index.php?topic=7493.0
-
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
-
Hi!
not work in 1.7.10 and 11
....
Since version 1.7.2 this modification is no longer necessary
mfg Andi