Page 1 of 1

[solved] Pretty url, path and news module

Posted: Sun Feb 05, 2012 7:01 pm
by Thosbk
Hi everyone,

I'm quite new to CMS (only a two month user :)), and moreover, I'm french, thus my english is not very good :D

I would like to first thank you for CMS-MS: it is really great, easy-to-use and powerfull. Thanks a lot !

I have a question on which I didn't find the answer. My question is propably stupid, so I prefer to apologize in advance :)

I created a website for the association of my parents and I would like to use pretty url. For now on, I only try on my computer with a local server (MAMP on a Mac) and I faced a small problem :)

I access to my "local website" by typing
"http://localhost:8888/AssociationAFDE/CMSMS/test/"

I change the config.php file (on the root) by adding the following lines:

Code: Select all

$config['root_url'] = 'http://localhost:8888/AssociationAFDE/CMSMS/test/';
$config['timezone'] = 'Europe/Paris';
$config['default_encoding'] = 'utf-8';
$config['url_rewriting'] = 'mod_rewrite';
$config['page_extension'] = '.html';
and also add a ".htaccess" file on the root of the folder, which contains

Code: Select all

Options +FollowSymLinks
RewriteEngine on
# Rewrites urls
RewriteBase /AssociationAFDE/CMSMS/test/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
This works quite fine, in the sens that the url now appear as, for example in a child section of a parent one:
".../parents/child/blabla.html"
However ...

1) In a child section, the path are now wrong. For example, there is a picture on the top of the website which is used/called by every page (it is contained in a cms "global content block"). This picture is called by

Code: Select all

<img src="uploads/images/global/mypicture.jpg" />
In a child section, this path becomes wrong. I can't figure out how to tell CMS to search on the root and not in the "child directory". I hope to be clear ? :)

2) The news module also change the paths in a much more pretty style, but not totally. I didn't find on internet if it is possible to make it prettier. Fow now on, on a news which is entitled "Reunion-9-Janvier-2012", the adress looks like
.../news/12/65/Reunion-9-Janvier-2012/d,evenements.html
Is it possible to obtain just
.../news/Reunion-9-Janvier-2012.html
?

Thank you a lot in advance and, again, thank you for the wonderful work you have done, and that you continue to do !

Here are some informations about my computer, I hope they are sufficient:
CMS version 1.10.3
MAMP server (Mac Os X Lion) 2.0.3
Apache 2.0 Handler (local server)
PHP Version 5.3.6

Re: Pretty url, path and news module

Posted: Mon Feb 06, 2012 4:38 pm
by spcherub
In response to your first question, putting a leading slash ( "/" ) in front of your path should fix the problem.

Code: Select all

<img src="/uploads/images/global/mypicture.jpg" />
If that does not work (due the specifics of your setup), you can do the following:

Code: Select all

<img src="{$root_url}/uploads/images/global/mypicture.jpg" />
-S

Re: Pretty url, path and news module

Posted: Tue Feb 07, 2012 10:14 pm
by Thosbk
Hi spcherub and thank you a lot for your answer !

However, it doesn't seem to work :-/

Indeed, when putting a "/" in front of the url lead to a disapearing of the picture (everywhere)...

And putting {$root_url} has no effect, even in the source code (as if it was empty)...

Thanks anyway :)

Re: Pretty url, path and news module

Posted: Wed Feb 08, 2012 10:47 pm
by spcherub
Do you have a version of the site that is publicly accessible? If so, send me the link and I can take a look.

BTW where do you have the image referenced? It is in the template or in every page's content block?

Re: Pretty url, path and news module

Posted: Thu Feb 09, 2012 3:49 pm
by Thosbk
Hi,

the website is here : http://www.familles-deuil-enfant.fr/
However, the website uses the version 1.10.1 of CMSMS (I did not make the update). Moreover, I let the simple url online to let it accessible (if I put the pretty url, then some things do not work anymore as explained)

The picture I was talking about is the one at the top of the page. And sorry, the website is in french :-)
The image is called in a "global content block" which is called by a template (not by every content pages).

Thanks again.

Re: Pretty url, path and news module

Posted: Thu Feb 09, 2012 4:00 pm
by spcherub
I took a look at the link you sent, but every page, including interior ones seem to show the image at the top of the page (as you desire). Can you send me a link where you are seeing the problem - or is that only with your local install?

Re: Pretty url, path and news module

Posted: Thu Feb 09, 2012 5:34 pm
by Thosbk
Yep for now I just try it on a local page.

I just made the change on line (!) so you can have a look. When it's ok, please tell me, so that I put the "working version".

Sorry for answering late: I'm still at work :-)

edit : I precise that the changes are done on line, on the website ... :-)

Re: Pretty url, path and news module

Posted: Thu Feb 09, 2012 5:54 pm
by Thosbk
Wait, that's funny : I put the "/" before the url of the image and it works !

I don't understand why it didn't work on my local webpage, but now it's fine on line !

Many many thanks and sorry for disturbing you !! :-)))

Re: Pretty url, path and news module

Posted: Thu Feb 09, 2012 10:17 pm
by Thosbk
For now on: everything is fine except for the Gallery modules. I will check, change some path and see if it's ok.

The last question I had is : is there a way to define the pretty url for the news module ?
For now, I have for example :

http://www.familles-deuil-enfant.fr/new ... fants.html

and I would like to have

http://www.familles-deuil-enfant.fr/nos ... tophe.html

Do you know if it's possible ?

Thanks again and have a good night (here in Belgium it's already the night :))

Re: Pretty url, path and news module

Posted: Fri Feb 10, 2012 2:44 am
by spcherub
I don't believe this is possible without modifying the code of the News module. In some cases there may be a way to simulate this behavior with the right directives in the htaccess file, but in this case there is no consistent pattern that can be leveraged.

Re: Pretty url, path and news module

Posted: Fri Feb 10, 2012 8:53 am
by Thosbk
Ok :)

Thanks again and have a nice day :)

edit : I would like to put [solved] in front off my topic, however, I must be too stupid: I don't find how to do it :-/

Re: Pretty url, path and news module

Posted: Fri Feb 10, 2012 11:44 am
by spcherub
Scroll back to the first post, then click on the "Edit" button just under it. This will allow you to edit the original post which changes the Subject.

Re: Pretty url, path and news module

Posted: Fri Feb 10, 2012 8:02 pm
by hasanen
There is URL field in news add/edit form at the bottom, maybe you can use that?

Re: [solved] Pretty url, path and news module

Posted: Mon Feb 13, 2012 10:15 am
by Thosbk
Hi and thanks both of you :)

I changed the topic's name.

hasanen: Yup, I tryed it and it seems to work ! Thanks a lot :)