Cant get it to work with "equal to" and "greater than".
foxhound |
|
---|---|
I added the following IF statement to my forums.post.tpl so it displays an add after the second forum post:
<!-- IF {FORUMS_POSTS_ROW_NUM} == 2 --> bla bla bla <!-- ENDIF --> But, it looks pretty bad cause right now there could be 2 adds and a signature on top of eachoter (I also have an add placed at the bottom of forums.post.tpl). So, I was hoping its possible to change the IF statement so it adds a block to the second post, but only when the total post count in the page is greater than 2. I tried many different setups of this but I cant figure out how to do it. I thought this would work but it doesnt: <!-- IF {FORUMS_POSTS_ROW_NUM} == 2 AND {FORUMS_POSTS_ROW_POSTCOUNT} > 2 --> bla bla bla <!-- ENDIF --> I searched both the Global Tag List as well as the TPL Tags Repository but have no idea what other statements I should use. The only one which works is the "{FORUMS_POSTS_ROW_NUM} == xx" as I use that multiple times. Anyone here who can help me with this? <img src="http://www.armaholic.com/datas/thumbs/green-sea-battalion-uniforms-version-03-preview_4.jpg" alt="green-sea-battalion-uniforms-version-03-" />
|
|
Dieser Beitrag wurde von foxhound (am 1. Dezember 2010, 17:59, vor 14 Jahre) bearbeitet |
Kort |
|
---|---|
change and to UPPERCASE first
SED.by - создание сайтов, разработка плагинов и тем для Котонти
|
foxhound |
|
---|---|
Sorry, thats a typo in my above post. It is in uppercase in my tpl.
I will fix my post. [edit] Also, I just realisized the "{FORUMS_POSTS_ROW_POSTCOUNT}" refers to a posters postcount, not the count of posts in a single topic page. And again, checking the tags lists there does not seem to be anything counting the posts per page? <img src="http://www.armaholic.com/datas/thumbs/green-sea-battalion-uniforms-version-03-preview_4.jpg" alt="green-sea-battalion-uniforms-version-03-" />
|
|
Dieser Beitrag wurde von foxhound (am 1. Dezember 2010, 17:47, vor 14 Jahre) bearbeitet |
GHengeveld |
|
---|---|
Try {PHP.totalposts}
|
|
Dieser Beitrag wurde von Koradhil (am 2. Dezember 2010, 04:41, vor 14 Jahre) bearbeitet |
foxhound |
|
---|---|
Exactly what I needed, works perfectly, even on the next pages of a topic even though "totalposts" implies to me it counts the total posts in a topic rather than the total posts in a single page.
I noticed it was not in the Global Tag List I went through this one and the tags list line by line trying to find something like it. Thanks for the help ![]() <img src="http://www.armaholic.com/datas/thumbs/green-sea-battalion-uniforms-version-03-preview_4.jpg" alt="green-sea-battalion-uniforms-version-03-" />
|
GHengeveld |
|
---|---|
You can access pretty much every PHP variable by using {PHP.variablename}, as long as they are defined at the time of parsing (meaning you cant use variables assigned in footer.php somewhere in your main template) and they are not out of scope (i.e. defined in a function or class).
You can access array values by using {PHP.arrayname.key}, for example {PHP.usr.id} (currently logged in user ID, or 0 for guests). Multidimensional arrays are supported too. This is why the list of possible tags is virtually endless. |
foxhound |
|
---|---|
Thanks a lot again for the additional info, very usefull. I wasn't aware I could call any variable like that (when defined).
Lots of opportunities with this ![]() <img src="http://www.armaholic.com/datas/thumbs/green-sea-battalion-uniforms-version-03-preview_4.jpg" alt="green-sea-battalion-uniforms-version-03-" />
|
Kingsley |
|
---|---|
# foxhound : Thanks a lot again for the additional info, very usefull. I wasn't aware I could call any variable like that (when defined). only if you know all the variables, yes.. |
foxhound |
|
---|---|
Well, that means you just have to look into the php files to find a variable, right?
You could even use variables which are introduced with plugins. So, if you need something open the php files and have a look at it. I guess even a noob like me can do that ![]() <img src="http://www.armaholic.com/datas/thumbs/green-sea-battalion-uniforms-version-03-preview_4.jpg" alt="green-sea-battalion-uniforms-version-03-" />
|
GHengeveld |
|
---|---|
Note that this functionality is not supposed to be a replacement for template tags. Actual template tags are much faster (performance-wise this feature is far from ideal, but it gives a lot of flexibility).
|
foxhound |
|
---|---|
I see, so if you do not want any performence impact I would have to create template tags of the variables I want to use? This is something I have no idea about so I personally have to stick with the php variables.
I dont think using one php variable in a tpl (like in my above example) has much impact on performance right? Or does that, like most times just depend on how many requests there are for that tpl? I had planned to use the same kind of "if statement" for my list.tpl as well. <img src="http://www.armaholic.com/datas/thumbs/green-sea-battalion-uniforms-version-03-preview_4.jpg" alt="green-sea-battalion-uniforms-version-03-" />
|