Render page under different url

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
jurrie
New Member
New Member
Posts: 9
Joined: Fri Feb 10, 2012 6:35 pm

Render page under different url

Post by jurrie »

Hello everyone,

I have a situation where I have categories and items within a category. Every item has a CMSMS page coupled to it, where different items can link to the same CMSMS page.

I have created a module and registred some routes, like so:
"http://cmsms.localhost/category/item/1
"http://cmsms.localhost/category/item/2
"http://cmsms.localhost/category/item/3

These pages flow through an action in my module called 'redirecttoitem'. This action allows me to first do something specific for the item id (like sending an email for item 3, doing a DB insert for item 1, etc).

Say for example that item 1 and item 2 link to CMSMS page "http://cmsms.localhost/mypage.

How can I get the HTML that would otherwise be outputted when I visit "http://cmsms.localhost/mypage, and have it outputted when I visit "http://cmsms.localhost/category/item/1?

Right now, in my 'redirecttoitem' action, I do header('Location: '.$url) to redirect to "http://cmsms.localhost/mypage. This is close to what I want, but not exactly. With this method, the URL in the browser is changed.

I want the URL in the browser to read "http://cmsms.localhost/category/item/1 and have the page be that of "http://cmsms.localhost/mypage.

How to achieve this? It seems so simple :)

Thanks in advance.

With kind regards,

Jurrie
Last edited by Dr.CSS on Thu Apr 25, 2013 10:16 pm, edited 1 time in total.
Reason: Please use double quotes on fake links so they aren't clickable...
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1967
Joined: Mon Jan 29, 2007 4:47 pm

Re: Render page under different url

Post by Jo Morg »

"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
jurrie
New Member
New Member
Posts: 9
Joined: Fri Feb 10, 2012 6:35 pm

Re: Render page under different url

Post by jurrie »

Jo Morg,

Thanks for your answer. But I don't see how to do the item-specific logic first then. Maybe you can give a short example?

Maybe my question should be rephrased: how to render a ContentBase instance? The closest I can come to is $contentobj->Show(), but the returned string contains unprocessed Smarty tags...
Post Reply

Return to “Developers Discussion”