Welcome Guest, Not a member yet? Register   Sign In
Front end architecture.
#1

[eluser]iambaz[/eluser]
Hi,

Recently I converted a CMS I had built to run on CI. I completed all the back end stuff and everything worked brilliant.

I have now come to develop the front end of the site and I'm faced with issues. The main being how I develop the front end to work dynamically and have sef url's.

I have a database of pages containing main page data such as content, title, alias and template etc.

Ultimately I need to be able to enter a url such as www.yoursite.com/page-alias/
and be forwarded to a 'router' class which will get all the global data for the page and then ship it off to the correct 'template'.

For basic pages this is obviously easy. I reroute everything using the router.php to the router class, take the uri segment as the page alias, load the page data and put it in the template.

My problem is the fact that the 'template' is not just a html page. The template could be something like 'events' in which case I have to perform lots of logic from a separate model etc to get the event data (Though I still need the global page data). Events is likely to have it's own controller doing things like filtering the events and will require a lot of code itself.

I know I can't load the events controller from the router controller and if I redirect it, I will lose the page data or will just be endlessly redirected back to the router class.

Ultimately, from the router controller I need to be able to go to another controller but retain the data which was originally set.

I hope people are able to understand me here - it's been a long day and my brain is about to give in. I know it's going to be difficult for people to give me a direct answer, but if anyone has any pointers on dealing with dynamic sites and SEF url's then they would be a big help. Code Igniter has been amazing for the back end work, but I'm struggling with it front end. Maybe I'm missing something obvious.

Thanks
#2

[eluser]WanWizard[/eluser]
In ExiteCMS every page is constructed from a master template, which contains the <head> section and the basic page layout. This template also defines page element locations (widgets). An element can be anything that produces HTML output.

Every element is powered by a separate controller, in a separate module. We use Modular CI for that. A Modular CI module is like a mini-app, it can have it's own models, libraries and views, so the logic can be as complicated as you want.

When a page is requested, the required template is retrieved from the database, the page content is retrieved (the list of elements), all element controllers are called, and their output is injected in the template.




Theme © iAndrew 2016 - Forum software by © MyBB