Problems, need help? Have a tip or advice? Post it here.
3 posts Page 1 of 1
Hello Couchers,

I'm using the following code to display blocks on a webpage each with an SVG animation and a link pointing to a single page based on the page_id. As I already thought PrettyURL's don't work with this solution.

Is there a way to create links from pages in which the page_id is included in such way PrettyURL's will work?

Code: Select all
<cms:pages masterpage='info.php' order='asc'>
    <a href="<cms:link masterpage='info.php' />?p=<cms:show k_page_id />" data-path-hover="M0,240.1V0h245v240.4c-34.5-32.9-77.9-54.4-123-54.4C76.7,186,38.3,207,0,240.1z">
        <figure>
            <svg viewBox="0 0 245 350" preserveAspectRatio="none"><path d="M0,248.1V0h245v248.4c-35.1,22.8-77.4,36.1-122.5,36.1C77.2,284.5,35.3,271.1,0,248.1z"/></svg>
            <figcaption>
                <h2><cms:show k_page_title /></h2>
                <h6><cms:show subtitle_text /></h6>
                <button><cms:show button_text /></button>
            </figcaption>
        </figure>
    </a>
</cms:pages>
Hi,

The <cms:link> tag (http://docs.couchcms.com/tags-reference/link.html) is prettyURLs-aware. So, assuming your site is already using prettyURLs, the following variation of your code should output the pretty-version of page links -
Code: Select all
<cms:pages masterpage='info.php' order='asc'>
    <cms:link masterpage='info.php' page=k_page_name />
</cms:pages>

That said, it appears from your code that you are trying to craft links of the pages fetched by <cms:pages> tag. For that it'd be sufficient to simply use this -
Code: Select all
<cms:pages masterpage='info.php' order='asc'>
    <cms:show k_page_link />
</cms:pages>

The 'k_page_link' variable would already contain the link (prettyURL aware) of each page being listed.

Hope it helps.
That's even easier than I thought it would be. Thanks KK for your help! :-)
3 posts Page 1 of 1