Forum for discussing general topics related to Couch.
7 posts Page 1 of 1
Hi

I have spotted a issue on a site that has couchcms integrated, after I click the blog link it goes to domainname.co.uk/blog/ which is fine but if I then click another link in the nav menu for example the contact link, it goes to domainname.co.uk/blog/contact and comes up with page not found as the url should be domainname.co.uk/contact

How do I correct it, I have a header.php file which has the following coding in

Code: Select all
<ul class="mbr-navbar__items mbr-navbar__items--right mbr-buttons mbr-buttons--freeze mbr-buttons--right btn-decorator mbr-buttons--active">
                                <li class="mbr-navbar__item"><a class="mbr-buttons__link btn text-another" href="<cms:show k_site_link />about">About us</a></li>
                                <li class="mbr-navbar__item"><a class="mbr-buttons__link btn text-another" href="<cms:show k_site_link />it-support">IT Support</a></li>
                                <li class="mbr-navbar__item"><a class="mbr-buttons__link btn text-another" href="<cms:show k_site_link />it-disposal">IT Disposal</a></li>
                                <li class="mbr-navbar__item"><a class="mbr-buttons__link btn text-another" href="<cms:show k_site_link />book-it-support">Book Repair</a></li>
                                <li class="mbr-navbar__item"><a class="mbr-buttons__link btn text-another" href="<cms:show k_site_link />shop/">Shop</a></li>
                                <li class="mbr-navbar__item"><a class="mbr-buttons__link btn text-another" href="<cms:show k_site_link />blog/">Blog</a></li>
                                <li class="mbr-navbar__item"><a class="mbr-buttons__link btn text-another" href="<cms:show k_site_link />contact">Contact</a></li>
                            </ul>


Thank you in advance
Hi,

Please visit the blog and then do a view-source: of the template. Take a look at the generated HTML for the menu.
What does the link for the contact page show up as? Is it fully qualified (i.e. has ' domainname.co.uk' prefixed)?

If you don't see the domain name, that would explain the issue - the 'contact' page link is being resolved relative to the current page, which is the blog, and hence the wrong URL.

If that is indeed the case, you'll have to find out why the <cms:show k_site_link /> is not outputting the root URL as it should.
My guess would be that it has something to do with your having placed the header in a .php file instead of a Couch snippet,

I'd suggest you try using a snippet instead and including it the Couch way e.g. <cms:embed 'header.html' />
Hi KK

Thank you for the reply, I have done that and the link is the source code is
Code: Select all
<a class="mbr-buttons__link btn text-another" href="contact">
As suspected, the href is relative and does not contain the output of <cms:show k_site_link />.
Please try using a Couch snippet as I suggested.
I have created the header.html in the snippets folder and the links are ok so just need to do it for the other pages now but noticed the <title></title> tag has <?php echo $title; ?> in it. How can I have it saying Contact but I will be using the header.html snippet file for the other pages as well

UPDATE: Got bit closer, I added
Code: Select all
<cms:show my_title />
to the title tag in header.html but it now shows domainname.co.uk/contact/

How do I add the page title from the admin side to show Contact

UPDATE: Sorry sorted it, I added
Code: Select all
<cms:set my_title="Contact" />
in the contact.php file about the template tag, is perfect now
I am not sure why you need to use PHP - I suppose you can output the name now simply using
Code: Select all
<cms:show k_page_title />

Anyway, if you have to use PHP, then the raw PHP code now needs to be converted to Couch <cms:php> tags.
The specific statement you have will become -
Code: Select all
<cms:php>global $title; echo $title; </cms:php>

You'll find some threads discussing this use of PHP through Couch tags, if you are interested in knowing more.
The recommended way, however, is to use Couch's in built functionality.

Hope this helps.
I only use php for the header.php and footer.php file and for couchcms

I have got it sorted now but on my blog article page the title tag is missing, it just shows
Code: Select all
<title></title>
in the source code. I have blog_list.html in the snippet folder and blog.php as the page for the articles, hope that makes sense

UPDATE: sorry sorted it, I created another header.html file in the snippet folder for the blog article itself and added
Code: Select all
<cms:show k_page_title />
in between the title tag and is perfect now
7 posts Page 1 of 1