Webmastersite.net
Register Log In

IF condition and php condition

Comments on IF condition and php condition

babrees
Expert

Usergroup: Customer
Joined: Aug 19, 2005
Location: England

Total Topics: 391
Total Comments: 1303
babrees
Posted Mar 14, 2007 - 12:10 AM:

I have an IF condition then insertfile plus a php condition that it is only produced on first page. It doesn't like both the IF and php and duplicates some of the content. Tried changing the IF to php but it hated that even more!

Here is what I have...
 
<IF {CATBREEDSTANDARD}>
<p>Looking for a {CATNAME} puppy, dog or advice? Contact one of the {CATNAME} breeders or breed clubs listed below. All dog breeders advertising with us agree to abide by our Code of Ethics.
</p>
<h2>{CATNAME} Books</h2>
<script src="<?php global $page, $templatesdir; if ($page == 1) { echo fileread("$templatesdir/custom/breedprofile.tpl"); } ?>
babrees
Expert

Usergroup: Customer
Joined: Aug 19, 2005
Location: England

Total Topics: 391
Total Comments: 1303
babrees
Posted Mar 16, 2007 - 12:47 AM:

Paul wrote:
I'm not sure if you can nest an INSERTFILE like that. Try
<?php global $page, $templatesdir; if ($page == 1) { echo fileread("$templatesdir/custom/breedprofile.tpl"); } ?>



That didn't work at all and made it a lot worse, just showing the {FIELDS} instead of the info.

In playing around I found that the problem wasn't in fact the php but the IF statement with the insertfile that is causing the problem. Take out the php leaving the IF condition and it still duplicates some content. Take out the IF and leave the php and it shows fine.
Search thread for
Download thread as
  • 0/5
  • 1
  • 2
  • 3
  • 4
  • 5



This thread is closed, so you cannot post a reply.