v2.2.3.1 trouble with core tag functionality with assign

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
rbaby
Forum Members
Forum Members
Posts: 144
Joined: Thu Feb 07, 2008 10:28 pm

v2.2.3.1 trouble with core tag functionality with assign

Post by rbaby »

Hi guys,

I can't seem to figure out what I am doing wrong with assign and calling it.
I'm using cms_selflink tag in my template:

{cms_selflink dir='prev' href='page_alias' assign='prev'} declared at the top and then:

Code: Select all

<div class="controls controls-prev"><a href="{$prev}"><i class="fa fa-chevron-left"></i></a></div>
The HTML output is nothing.

--

I'm also using the assign functionality on an image:

Code: Select all

{content_image block='stage_image' label='Stage Image' urlonly='1' exclude='thumb_' dir='images/stage' assign='stageimage'}
and {$stageimage} outputs nothing

--

Am I doing something wrong? I do have a {content} in the template and that seems fine but it seems that whenever I assign anything to it, it doesn't seem to render. Any insight would be greatly appreciated. Is there a cache I need to clear or something...? I see no errors but it just doesn't seem to do anything :(...



CMSMS v2.2.3.1
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3483
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: v2.2.3.1 trouble with core tag functionality with assign

Post by velden »

Where in the template do you do the assign and where do you try to read the variabele?

https://www.cmscanbesimple.org/blog/sma ... e-examples

(Note that the order is Top, Body, Head)
User avatar
Rolf
Dev Team Member
Dev Team Member
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Location: The Netherlands
Contact:

Re: v2.2.3.1 trouble with core tag functionality with assign

Post by Rolf »

- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
User avatar
PinkElephant
Forum Members
Forum Members
Posts: 169
Joined: Fri Feb 06, 2009 2:08 pm

Re: v2.2.3.1 trouble with core tag functionality with assign

Post by PinkElephant »

Hi rbaby
rbaby wrote:{cms_selflink dir='prev' href='page_alias' assign='prev'}
No output here either. I'm not sure if it's docs or code but {cms_selflink dir='prev' urlonly=1 assign='prev'} seems to work.
rbaby wrote:

Code: Select all

{content_image block='stage_image' label='Stage Image' urlonly='1' exclude='thumb_' dir='images/stage' assign='stageimage'}
As mentioned, looks like scope.
rbaby
Forum Members
Forum Members
Posts: 144
Joined: Thu Feb 07, 2008 10:28 pm

Re: v2.2.3.1 trouble with core tag functionality with assign

Post by rbaby »

Thank you guys, will try it!
rbaby
Forum Members
Forum Members
Posts: 144
Joined: Thu Feb 07, 2008 10:28 pm

Re: v2.2.3.1 trouble with core tag functionality with assign

Post by rbaby »

PinkElephant wrote:Hi rbaby
rbaby wrote:{cms_selflink dir='prev' href='page_alias' assign='prev'}
No output here either. I'm not sure if it's docs or code but {cms_selflink dir='prev' urlonly=1 assign='prev'} seems to work.
rbaby wrote:

Code: Select all

{content_image block='stage_image' label='Stage Image' urlonly='1' exclude='thumb_' dir='images/stage' assign='stageimage'}
As mentioned, looks like scope.
For some reason, that worked. Thank you. Any way I can only have it go prev/next within siblings and if it's the last, "next" to go to the parent?
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3483
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: v2.2.3.1 trouble with core tag functionality with assign

Post by velden »

'page_alias' is supposed to be an existing page alias.

IIRC $page_alias variable contains the page alias of current page. So {cms_selflink href=$page_alias ...} should work too. Note that you should NOT enclose the $page_alias variable with quotes!
User avatar
PinkElephant
Forum Members
Forum Members
Posts: 169
Joined: Fri Feb 06, 2009 2:08 pm

Re: v2.2.3.1 trouble with core tag functionality with assign

Post by PinkElephant »

rbaby wrote:Any way I can only have it go prev/next within siblings and if it's the last, "next" to go to the parent?
I'm not exactly sure what you mean by that but the cms_selflink tag can cover basic navigation...

Code: Select all

<h2>DEBUG</h2>

{cms_selflink dir='prev' urlonly=1 assign='x_prev'}
{cms_selflink dir='next' urlonly=1 assign='x_next'}
{cms_selflink dir='start' urlonly=1 assign='x_start'}
{cms_selflink dir='up' urlonly=1 assign='x_up'}

<p>prev={$x_prev}</p>
<p>next={$x_next}</p>
<p>start={$x_start}</p>
<p>up={$x_up}</p>

<hr>

{if empty($x_next)}
	<p>Nowhere left to go. Might as well go back
		{if {$x_up} != {$x_start}}
			up: {$x_up}
		{else}
			home: {$x_start}
		{/if}
	</p>
{/if}

<hr>
... but if you want something funkier then you might be better off calling {Navigator} with a template to iterate through the node hierarchy and do stuff as appropriate.
User avatar
PinkElephant
Forum Members
Forum Members
Posts: 169
Joined: Fri Feb 06, 2009 2:08 pm

Re: v2.2.3.1 trouble with core tag functionality with assign

Post by PinkElephant »

lib/plugins/function.cms_selflink.php (2.2.5) shows a couple of undocumented dir options which might be handy;

prevpeer (or 'prevsibling')
nextpeer (or 'nextsibling')

... when these go empty you're at the start/end of level.
Post Reply

Return to “CMSMS Core”