Hardcoding Concrete5 Generated Page(ID) Links in Theme Pages
Permalink
Hi Everyone
I've been looking through the forums trying to find an answer that is up to date and fully explained on how to hardcode a page generated in the C5 sitemap, back in to a theme file.
This is so for example, I use a staging server or sub domain to host the Concrete5 site, I might have some images that when clicked on - go to a specific page. If they are hardcoded with a pretty url, this wouldn't work from a staging or testing server. Am I being clear on what I'm after? Not sure how to explain it better than that.
Obviously it's a bit of php code that makes reference to the page id, but what are the steps / code required to do it?
Cheers!
I've been looking through the forums trying to find an answer that is up to date and fully explained on how to hardcode a page generated in the C5 sitemap, back in to a theme file.
This is so for example, I use a staging server or sub domain to host the Concrete5 site, I might have some images that when clicked on - go to a specific page. If they are hardcoded with a pretty url, this wouldn't work from a staging or testing server. Am I being clear on what I'm after? Not sure how to explain it better than that.
Obviously it's a bit of php code that makes reference to the page id, but what are the steps / code required to do it?
Cheers!
Perhaps I grossly misunderstand the problem but a pretty URL like '/contact-us' or even '/products/helmets/football/small/blue' will be the same on the dev server and production server. Hard-coding a full path will break but not a relative path.
Hi mhawke, thanks buddy.
Should I be turning pretty url's on from the beginning then? even on a testing server? I never used to turn them on until it was pushed to the live address. If so, whay there is an option to turn them on and off? Shouldn't they just be 'on' all the time?
It might need to look a bit harder at what I'm doing with my code.
For example, if I made a link in the footer of my theme with "/about-us" as the link... it would work fine from the home page. But if I got to another page other than the home page (e.g a contact us page) and I click the link, it tries to access the link like this: "contact-us/about-us", if that makes sense.
the only way I've found to go around this is to hardcode the entire url... "http://www.domain.com/about-us"
Maybe I'm doing something wrong, I guess I'm just a designer not a programmer, so I overlook a lot of things when I get in to the code.
I guess my other reason for bringing up page ID's is for when the client decides to move the page in the sitemap.
Interested to hear your thoughts & comments!
-Pat
Should I be turning pretty url's on from the beginning then? even on a testing server? I never used to turn them on until it was pushed to the live address. If so, whay there is an option to turn them on and off? Shouldn't they just be 'on' all the time?
It might need to look a bit harder at what I'm doing with my code.
For example, if I made a link in the footer of my theme with "/about-us" as the link... it would work fine from the home page. But if I got to another page other than the home page (e.g a contact us page) and I click the link, it tries to access the link like this: "contact-us/about-us", if that makes sense.
the only way I've found to go around this is to hardcode the entire url... "http://www.domain.com/about-us"
Maybe I'm doing something wrong, I guess I'm just a designer not a programmer, so I overlook a lot of things when I get in to the code.
I guess my other reason for bringing up page ID's is for when the client decides to move the page in the sitemap.
Interested to hear your thoughts & comments!
-Pat
Well you can do this:
Or look into using Manual Nav add-on
http://www.concrete5.org/marketplace/addons/manual-nav/...
Or the DIY Nav
http://www.concrete5.org/marketplace/addons/diy-navigation/...
I have to admit that I almost always develop a site, from day one, on the client's server, usually in a sub-folder off the root and then when I want to go live, I just copy the files from the sub-folder to the root or point the domain directly at the sub-folder if their hosting package allows that. I think I need to build the site under the same conditions that my client will have so I can spot any issues (like lousy speed) before my client points them out to me. I also like to give my client full access so they can give me feedback as I build (as messy as that is). It also means that all server issues are worked out BEFORE I even start building so I'm not up all night trying to fix a server issue the day before a promised launch date.
<a href="/index.php?cID=xxx">Target</a>
Or look into using Manual Nav add-on
http://www.concrete5.org/marketplace/addons/manual-nav/...
Or the DIY Nav
http://www.concrete5.org/marketplace/addons/diy-navigation/...
I have to admit that I almost always develop a site, from day one, on the client's server, usually in a sub-folder off the root and then when I want to go live, I just copy the files from the sub-folder to the root or point the domain directly at the sub-folder if their hosting package allows that. I think I need to build the site under the same conditions that my client will have so I can spot any issues (like lousy speed) before my client points them out to me. I also like to give my client full access so they can give me feedback as I build (as messy as that is). It also means that all server issues are worked out BEFORE I even start building so I'm not up all night trying to fix a server issue the day before a promised launch date.
Some good words of wisdom there mhawke.
Thanks for the solution.
Thanks for the solution.
You can also go into the target page's "Properties->Path Pages and Locations" and add a cleaner path in the More URLs box so for example if you had a page at 'Toys/Games/Monopoly' that you wanted to have easy access to you wherever the client moved it to on the sitemap, you could put just 'Monopoly' in the More URLs box and then refer to it like this:
[code]
<a href="/Monopoly">Monopoly</a>
[code]
Don't forget the leading slash.
[code]
<a href="/Monopoly">Monopoly</a>
[code]
Don't forget the leading slash.