CodeIgniter - where to put CMS - codeigniter

I come from a background of coding my client website projects from scratch with MySQL and PHP. They are typically public facing sites with a mixture of static content, dynamic content plus a little functionality here and there (i.e. account, searching etc). Nothing too heavy.
So I generally code up a little CMS site to let them update what they need to, put it in a protected folder and that's that.
Now I'd like to use CodeIgniter and more of a MVC approach for my next site. Should I be doing anything to separate the CMS out from the rest of the site or is it simply another area (with its own controllers/models etc) and extra authentication?

There are several good methods to create an admin interface in CodeIgniter described at:
http://philsturgeon.co.uk/news/2009/07/Create-an-Admin-panel-with-CodeIgniter
You probably will want to look mostly at "#2" on his list; it's lightweight and not much additional work.

The CMS is part of the site, if by CMS you mean administration panel / backend of your application, you can use the above link provided by coreylink as it details different ways to create an admin panel.
My personal preference is to create a folder called 'admin' in my controllers directory and create semantically meaningful names so my urls are webapp.com/admin/users and so on.

Related

How to integrate Magnolia CMS with Spring app in limited range

I have a question to Magnolia CMS (integrated with Spring) users.
I have to write e-shop integrated with CMS where we can divide all pages into two categories:
Edited and added by admin
static pages like user account settings, shopping cart etc.
First ones, must be totally customizable by admin - I mean, admin must be able to create his own template, add text areas or graphics/video whenever he wants. He also must be able ( this is very important) to create new products which must be also stored in db to be accessible for the application code ( to fill the products list by myself in the code or to set the prices on the static admin pages).
So user can add as many products as he would like, create separate template for some of them and I have to be able to search for this products in db ( for example when user try to use search criteria). The search panel must be created by me - but where admin will place it is up to him.
The second type of pages are static pages done in JSP and I do not expect to change it using CMS.
As the second type of pages is of course not a problem, I do not know what CMS solution I should use for first type of pages.
I thought about Magnolia CMS, but as I can see all templates must be created by programmer in the code.
Also I'm not sure if it's possible to implement mechanism to maintain products ( inside the e-shop) - from one hand admin must be able to add templates for them in CMS, but I must be able to access them from the code ( to maintain them at shopping cart, make invoice etc). The product prices are set from admin panel ( static pages) as well- not from CMS of course. Maybe I can add any single product at the static pages ( insert it into the db) and somehow connect CMS page with it ?
I also need to add that main page template must be designed by HTML designer, so perhaps it would be plain HTML and this main template would be updated due to the admin needs in CMS.
Cloud anybody please advice me the best CMS solution where I can achieve all this ?
Best Regards
I've seen fair number of shops implemented that way with Magnolia where you use spring & web flow to manage a shopping cart and checkout process, while letting editors to create & customise products & categories & promos available in the shop.
You can also get similar (w/o spring) integration just by installing shop module of Magnolia. It's product and product category management might come in handy even if you were to replace checkout by your own.
To answer the other questions and stipulations
you can write your templates in ftl and models in groovy and have those hosted inside of the repository, thus giving access to them to editor and allowing her to change whatever needs to be changed. However there is also danger in that since templates are responsible for generating html, editor might be able to break html layout by making changes directly to the templates. While you want editor to create new products and modify existing ones, Magnolia lets you separate template of products from the content of products so you can let editor to edit just all the fields that you deem editable for given product without having her to ever access html or ftl directly.
as you mention, html will come from designer, so what you pbly want is to take that html, break it into functional blocks that repeat in multiple pages, save it as ftl templates and replace sample text in there with FM tags to retrieve such data from Magnolia. Actually, even better, download the STK static prototype and hand it over to your graphic designer. Tell her to create design by changing css/js/images only, but not to change structure of the html itself in the prototype, then you can truly just drop in css/js/img provided back to you by the designer.
regarding static pages - you can always serve them from Magnolia even if you don't expect anyone to ever edit them (since it usually happens sooner or later that someone wants to edit them) or you can simply configure bypass for the url for such pages and have Magnolia ignore them so they can be served by underlying application server container
to bring in Spring based application, you might consider looking in more details at and using Magnolia's Blossom module which will in turn let you annotate your spring controllers to be treated as Magnolia templates to make integration even more simple.
HTH, Jan

MVC3 How to serve different versions of the site

I need to be able to serve different versions of my whole site per client. Certainly beta vs production but it would be nice to serve one or two prior production versions. Client customization is encouraged and I don't wish to force all clients to follow the (anticipated) pace of development.
Which version to serve is stored in the db.
From what Ive read so far a custom view engine may be the most straightforward way to accomplish this but before heading down this road I would welcome any advice and comment.
Thanks for insight!
Eric
EDIT: It isn't just the views that are different; controllers, master pages, images, CSS...
If the rules regarding which version is displayed to which user, I'm guessing they need to authenticate first. If that's the case you'll have opportunity to set a cookie on the user.
I would probably set a cookie on authentication that determines which version to show the user and then use a URL Rewriter like IIRF to direct requests with that cookie set to the beta version of the site.
Has the added benefit of users being able to opt back to the production site if they have issues with the beta.
I went down the view engine route How do I implement a custom RazorViewEngine to find views in non-standard locations?
Basically it's pretty stright forward, we have the same controllers models, etc. All the code is shared. The rendering of the views though is based on a "brand". So the view engine is clever enough to say if I'm brand A then the view will live in {standard view location}/brand/viewname.
It's hierachical though so if the view is in the branded folder it uses that one, else it falls back to the default location. It's basically an extension of the standard model used by MVC to find the location of the view source.

How do I create/obtain a permalink to user profile in Joomla?

I have just migrated a lot of content from an old webpage to a 2.5 Joomla website. Almost every imported page contains a contact detail of one person from a 3-10 people pool.
I would like to define these contacts as Joomla contacts and just simply link to these profiles from every page.
How do I find or create a permalink to these user profiles?
I don't know of a native Joomla way of doing this, but due to the frequent ugliness of Joomla urls, we use YOURLS as an all-around link shortener on all of our sites. It comes with a front end that users are able to create their own links, etc., but we just use the mechanism, and some of the other features on the admin site of things - the mechanism itself is quite straightforward and easy to use once you create one to see what needs to be in the database for it to do it's magic.

Possible to use one codebase for a subdomain for multiple sites?

I don't even know if this is even possible, but I thought I'd ask.
I am creating a small CRUD application but I have multiple sites. Each site would use the CRUD. The application would have common CRUD methods and style, but each individual site would apply different forms. I want to avoid creating multiple CRUD applications that varied only in specific content (just different forms).
I want to have something like this:
mycrud.website1.com
mycrud.website2.com
mycrud.website3.com
I can create a subdomain for each individual site no problem. But is it feasible to point all the subdomains to one MVC application directory? And if it is possible any suggestions for how I might go about restricting users from website1 from seeing website2 or website3 content? Is that something "roles" could take care of (after authenticating user)?
Thanks.
There are a lot of websites that do this, not just with MVC. Some content farms point *.mydomain.com to a single IP and have a wild card mapping in IIS.
From there, your application should look at the URL to determine what it should be doing. Some CMS systems operate in this manner, using the domain as a key to deciding what pages to load.
I've built a private labelable SAS application (Software as a Service) that allows us to host all of our clients in a single application. Some clients have customizations to pages or features. We are able to handle that by creating custom plugins for each client that over-ride the Controllers or Views when needed.
All clients share a common code base and aside from each clients custom theme/template they are the same. Only when a client had us customize one feature did we need to build out their plugin DLL. Now, this is advanced stuff so it would require heavy modifications to your code base but in the end if it's what your application needs it is 100% possible.
First - the easy part is having one web site for all three domains. You can do that simply with DNS entries. No problem. All three domains should point at the same ip.
As far as the content, you could do that in a number of ways. I think your idea of roles is pretty solid. It also leaves open the possible of a given user seeing content from both site1 and site2, if that would ever be necessary.
If you don't want to force users to authenticate, you should look at other options. You could wrap your CRUD logic and data access logic into separate libraries and use them across three different sites in IIS. You could have one site and display content based on the request URL. There's probably a lot of other options too.

codeigniter, admin system and auto load

Hello im working on a project and i have a footer and a sidebar that i want to load some information from the database, how can i do so it load the same on all pages.
i want to make a admin system to, how should i do that?, do i need to have a new codeigniter instillation or can i just create a new map in my controller,model and view maps ?.
how you guys doing it?.
The way I would go about it is create a MY_Controller and then put all of your generic logic inside of it and then all of your other controllers extend your MY_Controller. This saves you having to fetch content repeatedly and define and write the same code over and over again inside of your controllers. See Phil Sturgeon's article on base classes and keeping it DRY.
For templating your site including an admin panel, Phil Sturgeon has also created a simple template library that allows you to have themes on your site with different layouts you can switch between, etc.
As for creating an admin panel, Phil has also written a post on the subject as well and he goes into quite a bit of detail about the various ways you can develop an admin panel, which approach is best, etc. Some of the comments on the article are also very helpful too. Read his admin article here.
The templating method I usually use is as such... (it obviously is dependent on whether your sidebar, in your design, comes before/after the "content" in your markup)
<? $this->load->view('path/to/header') ?>
//content of page
<? $this->load->view('path/to/sidebar') ?>
<? $this->load->view('path/to/footer') ?>
Now if you are going to have variables you will need for every view, you can load them globally like so in the constructor of your controller.
$data->some_variable = $some_information;
$this->load->vars($data);
This will make $some_variable available to all views you load from that controller.
An admin system is simply another area of your site/application that is simply protected by an authentication system. You first need a way to verify the user's identity. I generally use Ion_Auth as my preferred auth library, and I have done a fairly extensive write-up on how to set up Ion_auth and your "protected" Controllers in a very clean fashion.

Resources