Problems, need help? Have a tip or advice? Post it here.
3 posts Page 1 of 1
Hello everyone, I'm currently using CouchCMS to make a website for a museum exhibit. I'd like to make the pages with individual objects accessible via their accession number (e.g. http://uni.edu/~museum/exhibit/objects/67.5.103.html). Unfortunately, it seems that periods are not allowed in page names: "Only Lowercase characters, numerals, hyphen and underscore permitted." Is there any way I can edit the CouchCMS files to allow this sort of behavior? Is there a reason I shouldn't do that? If it isn't possible, I don't mind using hyphens, but it's much more intuitive for everyone involved in the project to use periods.

Thank you in advance for your help!
Hi,

While you can modify the core files to make Couch accept the dot, I really don't think it'd be a good idea. This can possibly mess up things in unexpected way somewhere else as it is assumed throughout the code-base that page-names will not contain periods in them.
Thank you for the quick response! In case anyone else runs into this issue, I'll go ahead and log in this thread the changes I make and anything that goes wrong as a result.

In order to allow periods in page names, open /couch/functions.php and find function is_title_clean( $title ). Change the regular expression from '/^[0-9a-z-_]+$/' to '/^[0-9a-z-_\.]+$/', and save the file.

Everything appears to be working well so far. If you want to enable Pretty URLs (which is part of the point for me), you will need to also edit the generate_rewrite_rules() function in the same file. Find the section under // Page. Comment out the existing $body .= line just in case something goes wrong, and add the following instead:

Code: Select all
$body .= 'RewriteRule ^'. $val['pretty_name'].'(.+?)\.html$ '.$name.'?pname=$1 [L,QSA]' . $sep; 


Then run through the Pretty URLs instructions as normal.

I'll report back when something breaks! :P
3 posts Page 1 of 1
cron