template code <!-- IF issue

Discussion forum for MOD Writers regarding MOD Development.
Locked
User avatar
Sajaki
Registered User
Posts: 1372
Joined: Mon Mar 02, 2009 1:41 pm
Location: Amsterdam
Contact:

template code <!-- IF issue

Post by Sajaki »

hi,

i get this error with the below code :

Code: Select all

template->_tpl_load_file(): File ./styles/prosilver/template/dkp/block/block15.html does not exist or is empty

Code: Select all

<!-- IF S_BPSHOW -->
<!-- INCLUDE dkp/block/block15.html -->
<!-- ENDIF -->
but S_BPSHOW is false, so why is the template engine going into the if and including the nonexistant file ?
User avatar
Saldash
Registered User
Posts: 619
Joined: Mon Nov 10, 2008 8:08 am
Location: Flintshire, UK
Name: Stuart Jackson
Contact:

Re: template code <!-- IF issue

Post by Saldash »

Because you are only checking if S_BPSHOW has a value, not if that value is true or false ;)

Code: Select all

<!-- IF S_BPSHOW eq FALSE -->
<!-- INCLUDE dkp/block/block15.html -->
<!-- ENDIF -->
World Recoded UK - DreamHost Site of the Month winner February 2011!
User avatar
RMcGirr83
Former Team Member
Posts: 21609
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: template code <!-- IF issue

Post by RMcGirr83 »

Saldash wrote:Because you are only checking if S_BPSHOW has a value, not if that value is true or false ;)

Code: Select all

<!-- IF S_BPSHOW eq FALSE -->
<!-- INCLUDE dkp/block/block15.html -->
<!-- ENDIF -->
:?

So then why does this work if a user is logged in?

Code: Select all

<!-- IF S_USER_LOGGED_IN -->whatever<!-- ENDIF -->
...and if the user isn't logged in then they won't see "whatever".
Appreciate the extensions/mods/support then buy me a beerImage
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
User avatar
AmigoJack
Registered User
Posts: 5782
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: template code <!-- IF issue

Post by AmigoJack »

...because this is by far not the first time Saldash gives advices about things he doesn't know. :(

At the time the template file (HTML) gets parsed (to create its cache PHP file) the file to include must exist, regardless of any conditional arguments around that command. However, after the PHP cache file is created (i.e. /cache/tpl_prosilver_viewforum_body.html.php) this is not required anymore (but would nuke the display nonetheless if the file which should to be included does not exist, of course).

This behaviour at interpretation/compilation time assures that at runtime (when cache files have been created and are used) referenced files really exist.
  • The worst thing about censorship is ███████████
  • "The problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
User avatar
Saldash
Registered User
Posts: 619
Joined: Mon Nov 10, 2008 8:08 am
Location: Flintshire, UK
Name: Stuart Jackson
Contact:

Re: template code <!-- IF issue

Post by Saldash »

AmigoJack wrote:...because this is by far not the first time Saldash gives advices about things he doesn't know. :(
You care to name the rest? :evil:
I take that comment quite personally, everything I have done with phpbb has been of my own effort and if you take a look at a few things I've done on my own site, I don't think I've done too shabby on my own, and like 99% the rest of this community including YOU, are still learning and only trying to help!

So before you starting pointing fingers and posting my name in BOLD, think twice, think carefully.
A simple "Actually Saldash, that's not entirely true..[insert explanation]" would have sufficed fine!
Instead you try to discredit me, nice mate.. a real bravo for you.
World Recoded UK - DreamHost Site of the Month winner February 2011!
User avatar
AmigoJack
Registered User
Posts: 5782
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: template code <!-- IF issue

Post by AmigoJack »

I use bold formatting for names (nicks, files...), so it can be distinguished better. Yes, everybody is still learning. Me too. But it's the wrong way by letting others encounter errors from your own directions - you should encounter errors yourself to learn from, in the first place. Advices like "try", "maybe", "I guess" or the like always express uncertainty and hence the lack of being sure. If I'm not sure I don't consider to reply (and instead investigate on my own). Take it personally, but if people are asking questions here they should get useful instructions instead of doubts about the knowledge/experience of helpers.

Your own effort/site is as interesting to me as my sites/projects/manual MODs/skills/experience in PHP/CSS/ECMA/HTML/PREG/Pascal/AnsiSQL/C++/VB/VBS/VBA/Batch/Perl/Cobol are to you. I don't hink you know nothing, but don't expect me to thank people for misleading contribution.
  • The worst thing about censorship is ███████████
  • "The problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
User avatar
Saldash
Registered User
Posts: 619
Joined: Mon Nov 10, 2008 8:08 am
Location: Flintshire, UK
Name: Stuart Jackson
Contact:

Re: template code <!-- IF issue

Post by Saldash »

AmigoJack wrote:don't expect me to thank people for misleading contribution.
I never would, but there are better ways of doing it than you did above!
The least you could have done was say sorry for the way in which you said it, as that little one-liner of yours was very hurtful.. especially on a very public forum.
World Recoded UK - DreamHost Site of the Month winner February 2011!
professor mauricio
Registered User
Posts: 30
Joined: Tue Jul 12, 2011 4:54 pm

Re: template code <!-- IF issue

Post by professor mauricio »

what a mess

shouldn't moderators delete the posts above that are "off topic"?
User avatar
Saldash
Registered User
Posts: 619
Joined: Mon Nov 10, 2008 8:08 am
Location: Flintshire, UK
Name: Stuart Jackson
Contact:

Re: template code <!-- IF issue

Post by Saldash »

professor mauricio wrote:what a mess

shouldn't moderators delete the posts above that are "off topic"?
Especially posts necro'ing dead threads...
World Recoded UK - DreamHost Site of the Month winner February 2011!
User avatar
RMcGirr83
Former Team Member
Posts: 21609
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: template code <!-- IF issue

Post by RMcGirr83 »

Et finis per request.
Appreciate the extensions/mods/support then buy me a beerImage
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Locked

Return to “[3.0.x] MOD Writers Discussion”