Why I love Smarty Assign.
Let me start by saying I LOVE simplicity and I am especially keen to see simplicity on the web. To me, there is nothing more frustrating than an overly complicated application or website. At first glance it might look clever and sophisticated, but if it becomes a puzzle to accomplish the most basic tasks then there is something wrong in my opinion. If I wanted to torture my brain until blood came out of my ears then I would get into rocket science, brain surgery or perhaps those cryptic crosswords that appear on the back of oversized newspapers. Simplicity and ease of use are undoubtedly some of the reasons why Twitter became so popular; 140 characters, no complicated formatting, your granny could use it - and many do.
I’m not a simpleton, but I really don’t like it when things get all involved and difficult. If it doesn’t very quickly impress me as clear and straightforward then I’ll try something else and the vast majority of the time there's an alternative that fits my needs far better than the difficult option, thank you very much. I have taken this philosophy onboard in my working life, and always strive to ensure that the tools I use and the Websites I create are as unambiguous, and user friendly as possible.
Simplicity is the ultimate sophistication - Leonardo da Vinci
I distinctly remember the day I discovered CMS Made Simple. It was like a breath of fresh air after some of the other convoluted and impossibly awkward Content Management Systems out there. Yes, I looked at Wordpress, Joomla, Drupal, and most of the other alternatives, but at the time I really struggled to understand how I was going to easily incorporate them into my workflow. Perhaps that is the point: The others seemed to expect me to change and adapt my workflow to suit them - CMS Made Simple with the Smarty templating system allowed me to carry on without stopping for painkillers.
But not only is CMSMS easy for me to understand, my clients get to grips with it quicker too. I was demonstrating the CMS and handing over a site only a couple of weeks ago and within 5 minutes my client had created and published her first news article and was organising a new image gallery. Now that's user friendly!
But enough of what I think, what about other users of CMS Made Simple? I asked the question “what does CMS Made Simple mean to you?” in our social media channels and was rewarded with a variety of responses...
Some quite clearly had themselves as designers and developers in mind and included comments like: Back end customization with modules, rapid website development, out of the box template building, and the freedom to build whatever you want. Further comments were geared towards end users and included; a straightforward user interface, easy to explain for end users, ease of use for clients, keeping clients happy and productive, and so on...
All of your comments (apart from the one about the West life sound - you know who you are!) would seem to reinforce the fact that users of CMS Made Simple all have something in common: That is we are keen to get the job done most effectively with as little fuss as possible and we all find CMS Made Simple really lives up to its name by providing the simplicity we crave.
Perhaps I should stop a moment and say that it is important to realise that just because something looks simple on the outside doesn’t mean there isn't a lot going on 'under the hood'. CMSMS is no different in that respect - a lot of man (and woman) hours and some very clever programming have gone into making our CMS of choice as powerful and user friendly as it is. A lot of thought has gone into making our working lives, either as developers or users, easier. The fact that our CMS of choice is clear, concise, and easier to work with is a testament to the skills, forethought and continued hard graft of its developers.
Standing on the shoulders of giants - Isaac Newton
Ok, I think I got that off my chest. My rant is complete for this month. Until next time I will leave with one of my favourite phrases which I believe should be a motto for everybody because we are all capable of overcomplicating things so it often pays to remember:
Keep
It
Simple
Stupid!
Tony Williams
@tdlwebs
Running more than one site off a single cmsms
This month’s article deals with a very specific type of website; the small website, and how to run multiple small sites from one CMSMS install. Now many developers will tend to turn their noses up at the two, three, five or ten page ‘brochure’ site, often including me! There are a host of cottage-industry web designers out there, who cater very well for this market, not to mention the many ‘build your own website’ systems. I suspect a number of us would not usually create these sorts of sites, so before I get into the ‘how’, I thought I should explain the ‘why’.
I have a client that runs a local magazine. They make their money from advertising and regularly have contact with the smallest local businesses in the area; the handyman, the mechanic, the beauty therapist. You get the picture. As part of their business model, they provide these very small companies with additional services; design, printing and so on. It naturally followed that they wanted to do the same with websites and thus they approached me.
They wanted to offer a design led, yet still low cost solution, with the ability to edit existing pages. If the companies grew, they wanted to be able to move them up to something with more functionality. My client already uses CMSMS on their own site, so wanted to explore the possibility of running multiple sites on a single CMSMS build, with admin logins for their customers, who would access just their own pages and text.
So to return to the point of the article, I’ll explain how I got this working and leave you to decide the merits of it. As with so many CMSMS things, it’s actually very straightforward to do.
Ok. Let’s start with the obvious; page structure. Each sub-site within the CMS has all of its pages stored under a Section Header, grouping the right pages into the right ‘sites’. Whether this is then further broken down into sub sections is entirely up to your need, but for this I’ll assume we have a single set of pages under each section header.
The next job is the template(s) for any given site. Again, I’ll assume only one for this article. You build it in the normal way, simply telling your menu item to access the pages only in that section. There are a couple of options for that:
My personal preference is the catch all:
{menu childrenof=“section_header”}
Here, ‘section_header’ is replaced by the alias of the section header containing your site. The other option (which I used for years, proving even members of the dev team need to remember to read the module help sections) is:
{menu start_page=“sub-site-home” show_root_siblings=“1”}
All well and good if you can be sure the customer won’t change the alias of the start page, which you can’t, because customers at the best of times are unpredictable!
Whichever choice you go with, the end result should be the same; a menu that calls in just the sub-site pages. Our next job is to assign the right administrators to the right pages.
The first thing to do is create a new admin member group. I called it ‘Customers’. We’re going to give them no permissions at all. Yep, none! Now that’s done, I can create an admin member and assign it to that group. Of course if he or she logs in right now, the only available options would be change their details and preferences.
So the last bit to get them to the pages they need: I can go into the pages in the appropriate section and look in the ‘options’ tab. There, I can assign additional editors to that page. I choose my new admin member and assign them. Once I have completed that process for all the pages, my new admin member can log in and see just the pages they have been given editing permissions on. Exactly what the job required.
Now, my client’s requirements on this site were to allow their customers to change text, i.e. no pictures. This actually saved me an issue, in that adding the image button to the WYSIWYG would give a user access to ALL uploads/images folders. Not so good for privacy. However, I didn’t need to for the job, so I haven’t looked for a solution.
On that note, before we move on, a clarification. I am a firm believer in learning to do the things you need to do. No more. No less. So this article only covers the elements I had a need to do. If you need something additional, you’ll need to research it. And if you do, write an article about it and send it to us. We’ll be delighted to publish you in the newsletter and share your knowledge.
There was actually a discussion on the forum back in 2012 about limiting access in the uploads folder. So if this is something you need to explore, check out http://forum.cmsmadesimple.org/viewtopic.php?f=8&t=59997&hilit=limit+uploads+folders, it will be a good starting point.
Ok, let’s recap. Now we have a set of pages in a section header, with their own website template assigned to them, and with an admin member setup to access just those pages. So if we simply wanted to run all the sites from one URL, we’d be done. However, for obvious reasons that is unlikely to be the case. So we need to get the right domain pointing to the right section. Firstly we need to park an additional domain.
Parked domains are additional domains hosted on your account which display the same website as your primary domain. Make sure that the domain is question has its DNS pointing at your server / hosting. Then park the domain using the method advised by your host providers. For me, I use ‘Cpanel’ as my hosting control panel, so it’s nice and easy. I just go into Cpanel, click ‘parked domains’, then add my new domain.
Now, when I put the domain into my browser, I should hit the default page on my cmsms site. So I need to get it to reroute to the home page of the sub-site. Again, this should be doable through any control panel that pulls its own weight.
In Cpanel, once a parked domain is setup, there’s a neat little ‘Manage Redirection’ link. This allows me to set the page I want to redirect to; the sub site home page. Once I’m done, I refresh my browser and that sub site home page appears. Now one more thing to note; if I am creating a multi-domain site like this, I do not set a root url in the config, instead adding it in a metatags in the specific template. Other than that though, we’re pretty much there, right?
Well, kind of. I also want to stop any accessing the site through the root domain. In theory say my main site is www.johns-web-builder.com and my sub-site is www.jacks-expensive-jackets.com, then both www.johns-web-builder.com/jackets_home.html and www.jacks-expensive-jackets.com/jackets-home.html will show the same page. We all know how Google hates it when that happens. So, just to be on the safe side we need to make sure that anyone accessing the page on the ‘wrong’ domain gets moved to the ‘right’ domain.
There are of course a number of different ways to do this. I prefer something I can stick in the system. Thus I use a UDT. Here it is:
$url = $_SERVER['REQUEST_URI'];
$subdir = substr($url,0,7);
<br>if ( $subdir != '/admin/' ) {
<br>if ($_SERVER['HTTP_HOST'] != 'www. jacks-expensive-jackets.com){
header("Location: http://www.jacks-expensive-jackets.com ".$_SERVER['REQUEST_URI']);
<br>}<br>}
The first bit is a little hacky. I discovered that without the first three lines (and the last: the corresponding end of the ‘if’ statement), the rerouting happened in both public and admin page-editor pages. This caused merry chaos in admin, as you can imagine.
So those first three lines are basically saying “If we are not in admin do this, otherwise, don’t.” It’s hacky because of the way I’ve grabbed the final part of the url to see if it’s admin; basically counting the last seven chanracters and comparing that to “/admin/”. So, if you rename your admin directory, you’d need to mess with that accordingly.
However, the main bit of url juggling is in lines four and five, which simply states “if the domain before the page request isn’t www.jacks-expensive-jackets.com, reroute to that url, then append the page request to the end of it”. I drop this at the very start of my template, before the {process_pagedata} tag, and it reroutes to the correct URL. Google stops crying. Everyone is happy.
So in a nutshell, that’s how I have gotten multiple sites running from one CMSMS install. I don’t think running a site full of mini-sites will ever help you take on beat the likes of Wix, Moonfruit etc and nor should it; CMSMS is designed for bigger and better things. However, if you ever need to run two or more sites in one, I hope this will give you a starter on how to do it.
Written by John Scotcher
@jbookguy