Page 1 of 2
Improved clean url trick
Posted: Wed Jul 13, 2005 2:53 am
by ljbadenz
I am getting frustrated whit cmsms i've just installed it and are trying to set up some pages, but the error appears in the edit box thing - see screen shot.
It appears for 1 second then dissapears and all seems to be working well.
Except if I create an image, it says "no content" when I submit.
I aslo get an errormessage in the html code popup:
Warning: Smarty error: unable to read resource: "db:modules/TinyMCE/tinymce/jscripts/tiny_mce/themes/advanced/source_editor" in /home/www/ibbs/cmsmadesimple/lib/smarty/Smarty.class.php on line 1088
The only thing ive changed is add the .htacess file to enable the tidy url - I had to comment the php settings lines at the top or else my webserver stops working.
I enabled in config.php, in both htacess and config i changed the extension from .shtml to htm.
Ill try and diable it again and see if that amkes a difference.
---
I disabled it and it works... hmmm I wonder if its the page_extension setting its so touchy about. I'll investigate and return.
[attachment deleted by admin]
Re: Error message in /admin/addcontent.php
Posted: Wed Jul 13, 2005 3:00 am
by Ted
The problem is that a few of the things in TinyMCE are based on htm files. So, everytime it tries to open an htm via javascript, the server is running it through CMSMS instead... That's why we use the shtml extension because it causes no conflicts. There apparently is a way to get mod rewrite to only rewrite if it's sure the file doesn't phsyically exist first, but that's left as an exercise to the reader. (and if you do get it working, please post the results!).
Re: Error message in /admin/addcontent.php
Posted: Wed Jul 13, 2005 3:06 am
by ljbadenz
wishy wrote:
That's why we use the shtml extension because it causes no conflicts.
It works with shtml I jsut checked so ok, it was me trying to be clever and using .htm...
wishy wrote:
There apparently is a way to get mod rewrite to only rewrite if it's sure the file doesn't phsyically exist first, but that's left as an exercise to the reader. (and if you do get it working, please post the results!).
I'll try and research this...
Re: Error message in /admin/addcontent.php
Posted: Wed Jul 13, 2005 5:58 am
by ljbadenz
[glow=red,2,300]I finally got the .htaccess file to work with .htm extension, and for that matter any extension![/glow]
OK, now listen carefully this is what you do
(make sure you double check what you paste)
Here goes:
1. Follow the instructions in the wiki and setup tidy urls.
2. Edit your .htaccess file like so:
Code: Select all
php_flag magic_quotes_gpc Off
php_flag register_globals Off
php_flag session.use_trans_sid Off
# Make sure you have Options FollowSymLinks
# and Allow on
RewriteEngine On
#Rewrites page.shtml as index.php?page
#If page.shtml already exists as a file, then does not rewrite the URL
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteRule ^(.+)\.shtml$ index.php?page=$1 [QSA]
Note the new line
Code: Select all
RewriteCond %{REQUEST_FILENAME} !-f [NC]
This conditionally checks to see if there is a fille with the samename in the directory, if there is it doesnt rewrite the URL. This enables TinyMCE to read the files it wants with out apache changing the URL on it.
Now if you want to change the extension to .htm or anything for that matter do this:
1. Edit the .htaccess file by changing the RewriteRule to this:
Code: Select all
RewriteRule ^(.+)\.htm$ index.php?page=$1 [QSA]
2. Edit your config.php by changing the 'page_extension option to this:
Code: Select all
$config['page_extension'] = '.htm';
Now the tidy URL code is flawless, as far as I can see.
I've attached the modded .htaccess file using .shtml.
Be sure to rename it to .htaccess.
For the admins/programmers:
Update the wiki tips and tricks to include this new information.
Change the /doc/.htaccess.txt file in CMSMS to eh new one attached.
[attachment deleted by admin]
Re: Error message in /admin/addcontent.php
Posted: Wed Jul 13, 2005 9:49 am
by Ted
That's great. I'll add it to svn so it's in the next release. Thanks!
Re: Error message in /admin/addcontent.php
Posted: Thu Jul 14, 2005 2:40 am
by Ted
I've committed this to svn and also changed the defaults to .html
nice work!
Re: Improved clean url trick
Posted: Thu Jul 14, 2005 7:18 am
by ljbadenz
I've updated the wiki.
Re: Improved clean url trick
Posted: Tue Jul 19, 2005 5:03 am
by ljbadenz
Well done.
I see you managed to figure out the php.
Hope whishy takes some notice of this!
Re: Improved clean url trick
Posted: Tue Jul 19, 2005 8:19 am
by ljbadenz
I dont know the exact internal workings of cmsms, maybe whishy could fix it when he puts it into the svn.
Re: Improved clean url trick
Posted: Tue Jul 19, 2005 10:11 am
by Ted
Use $this->cms->config instead. Same with page_extension.
Re: Improved clean url trick
Posted: Thu Jul 28, 2005 6:52 pm
by 100rk