DataDoIT
|
Posted: 07/17/2012, 5:36 AM |
|
This one cost me a lot of time trying to figure it out, so I'll share
the solution so that someone else doesn't waste a day.
If you have a database-driven menu, and if your link contains a question
mark and URL parameters, CCS will remember those parameters on
subsequently loaded links.
Example menu:
Option 1: about/
Option 2: about/?p=WhoWeAre
Option 3: locations/
What will happen is that CCS will not forget that query parameter for
the rest of the links loaded afterwards, so it'll look like:
Option 1: about/
Option 2: about/?p=WhoWeAre
Option 3: locations/?p=WhoWeAre
To solve this, we have to tell CCS to forget about it after populating
the link. So in your menu's BeforeShowRow, add code (PHP):
//Clear out all Parameters from the URL here. Otherwise CCS will
//always remember the prior link's parameters.
$Container->Menu1->ItemLink->Parameters = null;
where "Menu1" is the name of your menu object.
|
|
|
bannedone
Posts: 273
|
Posted: 07/17/2012, 10:03 AM |
|
Outstanding tip Mike!!
I did something very similar for a CMS system I developed for my daughter. It demonstrates additional things you can do with your tip.
I had a need to create a CMS where my daughter could add pages and content from a database maintenance page. Pages are added just as records in the DB as well as content.
So by using this technique you suggest here, I was able to dynamically create the menu links in a CCS menu from the database.
You can see that here.. http://promotethekids.com (She has not added much content yet LOL). You will notice all the menu URLs drive thru once page display script with a page ID as a parameter (From The Database driving the content for that page.
This makes an extreemly user friendly CMS and most users can maintain their own site very easily. (BTW the site style was from Artisteer).
If anybody needs more details on how to do that, Contact me at: http://realwebdevelopment.us or http://realsites.biz/codecharge-studio-support
Or PM me here.
Have fun
BTW. Maybe one day i will try mod_rewrite to see if I can make these links appear more SEO Friendly..
_________________
John Real
CodeCharge Studio Support, Training, Consulting, Development, Web based solutions
http://realsites.biz
http://ccselite.com
Other Banned IDs on this Forum. jjrjr1, jjrjr2 |
|
|
bannedone
Posts: 273
|
Posted: 07/21/2012, 4:48 PM |
|
Well I finally had time to create CCS code for this CMS to support SEO friendly URLs and implemented mod_rewrite for the CCS implementation
more info here http://forums.yessoftware.com/posts.php?post_id=118876
_________________
John Real
CodeCharge Studio Support, Training, Consulting, Development, Web based solutions
http://realsites.biz
http://ccselite.com
Other Banned IDs on this Forum. jjrjr1, jjrjr2 |
|
|
MaFi
Posts: 49
|
Posted: 07/24/2012, 2:03 AM |
|
Another Way to get rid of the URL Parameters in the menu:
- Change to HTML Mode.
- Place the cursor in the menu link
- In the properties-data tab
change Preserve Parameters to none.
Martin
|
|
|
bannedone
Posts: 273
|
Posted: 07/24/2012, 7:32 AM |
|
Another GREAT tip MaFi...
I routinely use your solution for the problem.
_________________
John Real
CodeCharge Studio Support, Training, Consulting, Development, Web based solutions
http://realsites.biz
http://ccselite.com
Other Banned IDs on this Forum. jjrjr1, jjrjr2 |
|
|
DataDoIT
|
Posted: 07/24/2012, 8:53 AM |
|
Recognize that this tip is for when you're pulling your menu link values
from the database, and that value contains a question mark. Unrelated
to the IDE's Preserve Parameters setting, which is ignored in this scenario.
|
|
|
|