Foren / Cotonti / Skins / Page-specific tpl?

tensh
#1 15. Juni 2009, 15:50
Hi;

Is there a possibility to make a specific page use given TPL for a display, such as it is the case with categories (list.tpl)?
Kilandor
#2 15. Juni 2009, 17:02
Sorry but no the core has no such feature but you could core hack it pretty simply
tensh
#3 15. Juni 2009, 17:38
Thanks for reply, I'll check the possibilities.
Kort
#4 15. Juni 2009, 18:15
You might want to use trunk version of xtemplate.class.php to enable IF-blocks in templates
SED.by - создание сайтов, разработка плагинов и тем для Котонти
tensh
#5 15. Juni 2009, 19:46
Yes... but how would you use the IF block to achieve what I want? Hmm... "if page id=XX"? Then the page.tpl would grow quite big in case of multiple custom pages, and would not be easy to read. :) But yes, thanks for pointing that, it might be a fast solution for little custom pages.
Hodges
#6 3. April 2014, 09:53

*bump*

I've tried to implement what Kort has suggested, but I obviously don't know what variables are available in this context. This is my attempt:

	<!-- IF {PHP.page.id} == 22 -->
	<span style="float:right"><a href="index.php?e=page&m=add&c=members">Submit new member</a></span>
	<!-- ENDIF -->

Help! :)

Added 1 hours later:

Also how can I combine this with an if statement to check to see if the user is an admin?


Dieser Beitrag wurde von Hodges (am 3. April 2014, 11:06, vor 10 Jahre) bearbeitet
foxhound
#7 3. April 2014, 11:49

Maybe this plugin (last post) will be easier to use?

http://www.cotonti.com/forums?m=posts&q=6586&n=unread#unread

<img src="http://www.armaholic.com/datas/thumbs/green-sea-battalion-uniforms-version-03-preview_4.jpg" alt="green-sea-battalion-uniforms-version-03-" />
Twiebie
#8 3. April 2014, 12:31
#39366 Hodges:

*bump*

I've tried to implement what Kort has suggested, but I obviously don't know what variables are available in this context. This is my attempt:

	<!-- IF {PHP.page.id} == 22 -->
	<span style="float:right"><a href="index.php?e=page&m=add&c=members">Submit new member</a></span>
	<!-- ENDIF -->

Help! :)

Added 1 hours later:

Also how can I combine this with an if statement to check to see if the user is an admin?

You can do {PHP|dump} in the template to get all the available variables. Make sure debug mode is enabled though.

For your specific statement you could do something like this to check if the user is an admin:

<!-- IF {PHP.pag.page.id} == 22 AND {PHP.usr.isadmin} -->
<span style="float:right"><a href="index.php?e=page&m=add&c=members">Submit new member</a></span>
<!-- ENDIF -->

Here is some good documentation:

http://www.cotonti.com/docs/ext/themes/cotemplate_debug_mode
http://www.cotonti.com/docs/ext/themes/cotemplate_statements


Dieser Beitrag wurde von Twiebie (am 3. April 2014, 12:57, vor 10 Jahre) bearbeitet
Kort
#9 3. April 2014, 12:39

That should be:

<!-- IF {PHP.pag.page_id} == 22 AND {PHP.usr.isadmin} -->
<span style="display:block; float:right"><a href="{PHP|cot_url('page','c=members&m=add')}">Submit new member</a></span>
<!-- ENDIF -->

not

{PHP.page.id}

 

SED.by - создание сайтов, разработка плагинов и тем для Котонти

Dieser Beitrag wurde von Kort (am 3. April 2014, 12:53, vor 10 Jahre) bearbeitet
Hodges
#10 3. April 2014, 13:46

Works perfectly. Thanks guys for the swift replies!