solved Adding To Templates On A Per Url Basis

Ceri
Ceri
@adolygwr
9 years ago
370 posts
Is there anyway to add a feature to a single page via the template editor? Let's say I wanted to add something to group but ONE GROUP ONLY would it be possible to specify that the div or whatever I chose to add should appear on that one group page only?


--
Ceri Shaw - AmeriCymru

updated by @adolygwr: 03/25/16 04:29:00PM
michael
@michael
9 years ago
7,715 posts
yes.

The rest of the details depend on what the url look like, which template you're altering and what the group id is.

The general idea/concept is to figure out a variable that will exist on in the template you're altering, then use that as a conditional to display/not-display the section.

Docs: "Template Blocks"
https://www.jamroom.net/the-jamroom-network/documentation/development/3126/template-blocks

So if you know the group_id turns up in that template, use that as the {if} condition.

{if $?????_group_id == "1"}.......{/if}
Ceri
Ceri
@adolygwr
9 years ago
370 posts
I seem to have goofed. I was assuming that the group id was 9 as in the url:- http://americymrunet.jamroomhosting.com/ceri-shaw/group/9/welsh-music

Here is the code I added:-

{if $9_group_id == "1"}<div class="title"><h3>Latest Tracks</h3></div>{/if}
{if $9_group_id == "1"}{jrCore_list module="jrSoundCloud" order_by="_created desc" limit="12"}{/if}



--
Ceri Shaw - AmeriCymru

updated by @adolygwr: 12/14/15 08:23:10PM
michael
@michael
9 years ago
7,715 posts
Yeah, best not to assume anything. Use {debug} to find out for sure.

Docs: "{debug}"
https://www.jamroom.net/the-jamroom-network/documentation/development/1477/debug

So its the group id 9 that you want to show it for then? if so, thats going to be on the = side of the equation.

{if $group_whatever_id == "9"}......{/if}

Its probably going to end up being:
{if $group_id == "9"}......{/if}
OR
{if $item.group_id == "9"}......{/if}
OR
something similar.

--edit--
Oh, and that block can be as big as you need it to be, dont need to check for each line:
{if $group_whatever_id == "9"}
......
......
......
......
......
......
......
......
{/if}

updated by @michael: 12/14/15 09:16:20PM
Ceri
Ceri
@adolygwr
9 years ago
370 posts
k....many thanks..will play with debug. Have already tried $group_id $item.group_id $jrGroup_id and $item.jrGroup_id and it aint any of those :)

Just one thing though is there a way of adding unique content to a page anywhere on the site, in any module, something like the smarty currenturl variable?


--
Ceri Shaw - AmeriCymru

updated by @adolygwr: 12/14/15 09:54:54PM
michael
@michael
9 years ago
7,715 posts
Put {debug} in there, see what matches the answer for "9" and then see what the variable is. There are probably a few options. There will be one in $_post for sure as $_post contains the stuff from the URL.

Ceri:...is there a way of adding unique content to a page anywhere on the site, in any module, something like the smarty currenturl variable?....

Too broad a question to answer. Probably yes, but it always depends on where and what.