Problems, need help? Have a tip or advice? Post it here.
4 posts Page 1 of 1
Hi, I'm trying to create a list for internal linking with a dropdown in the admin panel.

Therefore i created a dropdown, which is loading the following snippet

Code: Select all
choose|
<cms:templates>
<cms:if (k_template_name ne 'globals.php') && (k_template_name ne 'galerie.php')>
<cms:show k_template_title/>=<cms:show k_template_name/>|
       
         <cms:if k_template_is_clonable>
             <cms:pages masterpage=k_template_name>
                <cms:show k_page_title/>=<cms:show k_page_link/>|
            </cms:pages>
         </cms:if>
</cms:if>
</cms:templates>


the links to none clonable templates working fine, but the links to the cloned pages outputs something like this: http://localhost/MT/page.php?p

So the numbers of the pages are missing in the link. What did I wrong?

Thank you very much!!!
Hi,

What seems to be happening is this -
The following staement in your code is using '=' as the value separator
Code: Select all
<cms:show k_page_title/>=<cms:show k_page_link/>|

Now if the value contained in k_page_link also happens to have another '=' (as it does in e.g. http://localhost/MT/page.php?p=36), that confuses the parser.

To resolve this situation, we need to specify a separator character that does not appear within the values or, alternatively, escape the '=' character with a backslash (i.e. make it '\=').

Escaping will require a bit of PHP so let us just define a new val separator. Make the following change to your dropdown's definition -
<cms:editable
name='page_links'
opt_values='list_page_links.htm'
dynamic='opt_values'
type='dropdown'
val_separator='#'
/>

As you can see, we are specifying a 'hash' in place of the 'equal to' as the separator.

Make sure to visit the modified template as super-admin for the change to take effect.
Now use the new separator in your snippet e.g.
<cms:show k_template_title/>#<cms:show k_template_name/>|
..
<cms:show k_page_title/>#<cms:show k_page_link/>|
..

Note that there are two places in your code where we use this separator.
And now you should output the links as expected.

Hope it helps.
Works Perfect!!!!!!!!!!!

Thank you very much :P
You are welcome :)
4 posts Page 1 of 1