Problems, need help? Have a tip or advice? Post it here.
14 posts Page 2 of 2
Hello @KK and couchers.

I'm confused as to why my page links aren't coming through this dropdown. Inside my Snippets directory I have
homepage_list.htm:
Code: Select all
Please Select=-
|Place Deposit Section=#deposit
|Pairing Section=#pairing
|Daily Video Section=#daily_vid
|Photo Gallery Section=#gallery
|Contact Section=#contact
<cms:pages masterpage="pairing.php" >
    | <cms:show k_page_title />=<cms:show k_page_link />
</cms:pages>

NOTE: For troubleshooting, I had the dropdown show me the link (as opposed to title) just so I can visually see it's 'link' output - see the attached images for the results

Inside my index.php template tags inside repeatable tags I have this dropdown:
Code: Select all
<cms:editable type='dropdown' name="hm_sld_c2a_btn_lnk_rpt" label="c2a Button Link"
            opt_values='homepage_list.htm'
            dynamic='opt_values'
            order="58"
        />


My problem is that while the dropdown iterates through each page, it can tell me the title, the name, etc, but when it comes to showing k_page_link, it's not showing the page's link. I've uploaded some screen shots that show that no page links show up, but that it is indeed pulling the page titles.

I think there's something wrong with the coding because whenever I choose an anchor as the selection from this same dropdown, everything saves and works fine - upon clicking the button the navigation takes me to the correct section of the page. But whenever I choose a one of the 'pairing' cloned pages, after I save the admin page the dropdown field shows that it has changed to the very last one (pairing 1).

Is there an inherent block in being able to see k_page_link under the pages tag for a template when using this process for a template dropdown?

Attachments

@scratz,
What seems to be happening is this -
When the following piece of your code gets expanded
Code: Select all
<cms:show k_page_title />=<cms:show k_page_link />

it becomes
Code: Select all
Pairing 3=http://localhost/saggybottom/pairing.php?p=123

Please note above that there are now *two* '=' signs.

This '=' sign holds special significance for the dropdown as it separates the 'value' from the 'key' of each option e.g.
Code: Select all
|Daily Video Section=#daily_vid
|Photo Gallery Section=#gallery

The '|' used above is another special character that separates each options.

If the contained markup happens to use these two characters, this will confuse the parser (as we see happening in your case).

The solution for such use-cases is to specify a different character for the problematic separator.
<cms:editable type='dropdown'> accepts params named 'separator' and 'val_separator' for this purpose.

For our case, changing the 'val_separator' would suffice. Let us use '@' instead of the default '='.
Specify this change in your editable region's definition as follows -
Code: Select all
<cms:editable type='dropdown' name="hm_sld_c2a_btn_lnk_rpt" label="c2a Button Link"
            opt_values='homepage_list.htm'
            dynamic='opt_values'
            order="58"
            val_separator='@'
        />

Then use the new separator in your snippet as follows -
Code: Select all
Please Select@-
|Place Deposit Section@#deposit
|Pairing Section@#pairing
|Daily Video Section@#daily_vid
|Photo Gallery Section@#gallery
|Contact Section@#contact
<cms:pages masterpage="pairing.php" >
    | <cms:show k_page_title />@<cms:show k_page_link />
</cms:pages>

Visit the template as super admin for the changes to take place and now the dropdown should work as expected.

Hope this helps.
Visit the template as super admin for the changes to take place and now the dropdown should work as expected.


Yes sir, that was the issue. Once I used another val_seperator to allow '=' to be passed untouched by the function, the dropdown works as expected.

As always, many thanks, @KK!
You are welcome :)
14 posts Page 2 of 2