Problems, need help? Have a tip or advice? Post it here.
7 posts Page 1 of 1
Hello all!
Couch is absolutely fantastic. what a great system and way to help people easily and safely create customized websites. KK and Cheesypoof, these are just amazing concepts and practices. I get blown away and look forward to all the new things I learn each time I read the forum.

I am stuck on my current site and it concerns custom routes and the use of prettyURLs. I was surprised that I couldn't find anything on this forum about it, which leads me to believe I am doing something wrong. I read just about everything I could find and still was unable to come up with a solution.

My site is a mix of custom routes and regular couch links. My blog has the custom routes so I can get author views, category views, etc. Everything works fine until I turn on prettyURLs. I am running the gen_htaccess.php and creating the .htaccess file from that.
When I click my blog link, it will go to the blog. If i manually type in "..../blog.php" the correct view of the page will render.

Am I missing how to format the nav-bar link for a page built on custom views? Or are prettyURLs not possible with the custom views?

Thank you for your help.
Hi :)

We can absolutely use prettyURLs with custom routes.
The links now, however, need to be generated using <cms:route_link> tag as explained in the docs -
http://www.couchcms.com/docs/custom-routes/#gen-urls

Could you please confirm that you are indeed using the mentioned tag and that the links outputted by it match the format of your custom scheme?
Well, I knew it had to be given how full-featured Couch is.
But, yes, I am using

Code: Select all
<cms:route name='list_view' path='' />


for my list view and

Code: Select all
<a href="<cms:route_link 'list_view' />">


on the nav bar.
since there is nothing for the path, there's no rt_ to fill in. Is that correct?
since there is nothing for the path, there's no rt_ to fill in. Is that correct?
That's correct.

So what is the output you get? If it is blank perhaps you need to specify the 'masterpage' parameter as shown in the docs
Code: Select all
<cms:route_link 'edit_view' masterpage='test.php' rt_id='41' />

If you need help, please feel free to PM me the FTP/Couch access code to your site (assuming it is online) and I'll take a look at the issue.
yes sir, I did use the masterpage parameter as well as other combos. Here is what I started with as per the docs:
Code: Select all
 <a href="<cms:route_link 'list_view' masterpage='blog.php' />">

, but get the same results. It comes out as like no page to read:
Image


A piece of code I forgot to include in this post is the matched route statements, which are:

Code: Select all
<!-- find the match routes -->
cms:match_route debug='0' is_404='1' />
<!-- implement the selected view -->
<cms:if k_matched_route=='page_view'>
<cms:embed 'blog/blog-default.php' />
<cms:else />
<cms:embed "blog/views/<cms:show k_matched_route />.php" />
</cms:if>

and I have verified the page name (list_view.php) is in the 'views' folder of 'blog' in 'snippets'.

As I said, the pages come up as expected until prettyURLs are turned on.

the site is online at http://scratz.me. the issue is with blog.

I will PM you some creds. I thank you so much for your time.
Hi @scratz,

Apologies for taking this long to address your issue.
I finally got around to log into your site today.

While I did not have FTP access to the site, I could see the problem you mentioned -
If i manually type in "..../blog.php" the correct view of the page will render.

When the prettyURL version of the link is used (e.g. /blog/), we get -
no-screen.JPG
no-screen.JPG (18.34 KiB) Viewed 2305 times

What seems to be happening is that your site has a *physical* folder named 'blog'.
Since .htaccess first checks for physical files/folders and before applying the rewrite rules, when '/blog/' is used, the contents of the physical folders are served instead of your template.

Please verify this. If there is indeed a folder named blog, rename it to something else and see if the problem is solved.

Do let me know.
That was exactly what the problem was. It wasn't even anything I was looking for. :oops:

Thank you so much for spending the time to help. I hope this helps other people who might run across the same thing.
7 posts Page 1 of 1