I’m looking to integrate Pulse into an existing site and was thinking that I would just use Blocks and be done with it. But I’ve been looking at the Pages feature which appeals to me because it would be nice to generate new pages on-the-fly. However, after looking through the docs - and as far as I understand - the layout.php file in the Template folder serves as the base template for every page that’s created. Does this mean there can only be one template for an entire site? What if I need to be able to choose from multiple templates? Am I out of luck?
Hi Todd,
This is how pages currently work in Pulse although you can easily add what you need with a little custom PHP. If you add a PHP variable into the top of each page (maybe the page slug I mentioned before for the navigation) you can then add a switch to layout.php that pulls in the correct layout page for the content being rendered.
For example:
In your page include:
<?php $pageslug = "contact"; ?>
In layout.php:
switch ($pageslug) {
case “contact”:
<?php include("template-for-contact-pages.php"); ?>;
break;
case “about”:
<?php include("template-for-about-pages.php"); ?>;
break;
case “who”:
<?php include("template-for-who-pages.php"); ?>;
break;
default:
<?php include("template-for-all-other-pages.php"); ?>;
}
?>
You could do this without the page slug variable by looking at the data you are including into the page but I think this keeps the process quite simple and easy to understand. What I like about Pulse is that it very easy to extent the core CMS to add your own bespoke features. So far I’ve integrated event registration systems, custom image galleries, as well as smaller tweaks like this and the nav bar additions.
Regards,
Tim.
On 24 Jan 2014, at 05:03, Todd wrote:
Does this mean there can only be one template for an entire site? What if I need to be able to choose from multiple templates? Am I out of luck?
This is interesting but bear with me as I wrap my head around your idea.
It seems that before the client could create a new page, eg, ‘MyStuff’ (and assuming the new page would require its own unique template), then a ‘MyStuff’ template would already need to be referenced in a new ‘case’ before it could be used, correct?
Where do these templates eg, template-for-contact-pages.php exist? Are they actual php files that I manually create outside of Pulse or do I create them within Pulse as a Page or Block?
If a page is created that doesn’t require a unique template is the default layout.php template used instead?
Todd
This is how pages currently work in Pulse although you can easily add what you need with a little custom PHP. If you add a PHP variable into the top of each page (maybe the page slug I mentioned before for the navigation) you can then add a switch to layout.php that pulls in the correct layout page for the content being rendered.
For example:
In your page include:
<?php $pageslug = "contact"; ?>
In layout.php:
switch ($pageslug) {
case “contact”:
<?php include("template-for-contact-pages.php"); ?>;
break;
case “about”:
<?php include("template-for-about-pages.php"); ?>;
break;
case “who”:
<?php include("template-for-who-pages.php"); ?>;
break;
default:
You could do this without the page slug variable by looking at the data you are including into the page but I think this keeps the process quite simple and easy to understand. What I like about Pulse is that it very easy to extent the core CMS to add your own bespoke features. So far I’ve integrated event registration systems, custom image galleries, as well as smaller tweaks like this and the nav bar additions.
This is interesting but bear with me as I wrap my head around your idea.
Sure. You should know that although I really like the way that Pulse deals with blocks the way that it handles pages is a little odd IMHO as the user will often have to deal with the page PHP directly (something that 99% of my clients would run screaming from).
It seems that before the client could create a new page, eg, ‘MyStuff’ (and assuming the new page would require its own unique template), then a ‘MyStuff’ template would already need to be referenced in a new ‘case’ before it could be used, correct?
Correct. This would only really work for your client if you had a fixed set of page templates that you’d pre-populated in the CMS and added to the layout.php file. Your client will have access to the PHP in the pages through Pulse but not the layout.php file or the page templates themselves.
Where do these templates eg, template-for-contact-pages.php exist? Are they actual php files that I manually create outside of Pulse or do I create them within Pulse as a Page or Block?
The way that my example works they would live alongside the original layout.php file. You’d need to hand code each of these to provide unique layout options that your client can add his content to.
If a page is created that doesn’t require a unique template is the default layout.php template used instead?
Unlike a standard if else statement the switch statement in layout.php will look for a match for the pageslug variable and if it finds one it will load in the correct layout php file. If nothing matches the default value is used which means that you only need to add the page variable ($pageslug) and line to the switch statement for unique pages as all untagged pages will simply use the default page template at the bottom of the switch.
All we are doing here is extending the single layout.php file by allowing us to choose one of a number of predefined layout pages based on a variable we set in the page itself.
The thing that is a little scrappy from a client perspective is that they would need to add the correct page slug variable to the top of the page PHP code. The latest version of Pulse includes UI for the page name and description but unless you wanted to add the slug variable to this UI they would be left having to remember to add it in manually.
Unlike blocks pages in Pulse still need a little more thinking about (IMHO) as it would be good to see a visual way of handling these rather than the code view we currently have.
I guess what I’m asking is whether the predefined layouts are simply Pulse pages that I create, ie, I paste whatever template/page code I want then I reference said page in the main layout.php file?
I agree the handling of pages is odd and not exactly user-friendly. Your idea is useful and might be good if I were managing the site but it seems too hands-on for my client. I want them to be able to do it themselves and not rely on me to add a page. Honestly, I think it’s easier for them to duplicate a page and just embed the Block code. In this regard I think Perch is much nicer.
Thanks,
Todd
All we are doing here is extending the single layout.php file by allowing us to choose one of a number of predefined layout pages based on a variable we set in the page itself.
Please disregard my previous question, you obviously already answered it. My mistake.
Thanks,
Todd
The way that my example works they would live alongside the original layout.php file. You’d need to hand code each of these to provide unique layout options that your client can add his content to.
I use Pulse very infrequently, I tend to prefer other systems with a native new page process. With regard to my original post in this thread I didn’t use Tim’s suggestion because it was too hands-on for the client.
So I’m not the person to answer this but Tim certainly could as he’s more familiar with Pulse.
Todd
Hi Tim/ Tod,
I read your discussion above.
Very interesting, I also need the “add new page” function for a website.
But it is not clear for me how to install everything, maybe one of you can help me with this?
First I installed Pulse (Method A - Using Pulse with your own template or existing site) as described here: http://pulsecms.com/docs-install
To use the pages feature in Pulse you’ll need to use (or create your own) template and place it in the ‘template’ directory alongside Pulse on your server. If you are just using blocks then you can ignore this template and just retrofit the block code to your Freeway pages. At the moment Pulse only supports a single page template (you can hack this to support multiple templates by following the instructions in this thread) but editing pages is (unfortunately) a code-driven exercise.
I’d love to see pulse have a visual UI for pages so you could drop blocks into the page template but I suspect I’m asking for way too much for such a simple CMS.
Regards,
Tim.
On 8 Oct 2014, at 22:26, Erik wrote:
I read your discussion above.
Very interesting, I also need the “add new page” function for a website.
But it is not clear for me how to install everything, maybe one of you can help me with this?
First I installed Pulse (Method A - Using Pulse with your own template or existing site) as described here: http://pulsecms.com/docs-install
I need a CMS to integrate with freeway which have the “add new page” functionality so my client without any knowledge of coding can add a page (prepared template) which can be edit
Any suggestion if there is something which is also integrate friendly
I need a CMS to integrate with freeway which have the “add new page” functionality so my client without any knowledge of coding can add a page (prepared template) which can be edit
Any suggestion if there is something which is also integrate friendly
I have several favs but right now I currently use just a couple for production, though I’m continually testing a few of the dozens currently available (lots of nice ones out there).
Perch - I’ve used this numerous times for production and it’s actively developed. A capable CMS though it’s more hands-on to setup. http://grabaperch.com
Craft - I’ve not used it for production yet but I have done some fairly extensive local testing. There’s a lot to like and worth a closer look. http://buildwithcraft.com
MojoMotor - I’ve used this production once and really liked it because it uses in-page editing (like WebYep but more polished). https://ellislab.com/mojomotor
MODX - On the surface it seems like the oddball in this list because it’s a very robust system but I’ve used it for very small sites with great success. The reason is because it’s extremely customizable. I’ve tailored it to the client’s needs to such an extent that the Perch UI by comparison starts to look cluttered. A great system that even extremely non-technical clients love to use. It keeps getting better. http://modx.com
There are of course many others worth mentioning but if you want more tell us the specifics of the project and we can tailor our suggestions.
I know it sounds like I am blowing my own trumpet but webyep’s been able to create pages via a user interface for years… your not even restricted to using a specific template you can use it for non webyep pages or webyep controlled page/s
Hi Billy,
I wouldn’t call it a hack but you can easily extend the stock Pulse slider with various options. Dig around in your Pulse folder and you should find the PHP file that handles the slider at;
pulsepro/includes/gallery.php
This is the start of the configuration settings for the slider. What you want to do is add in a line of code that tells the slider to slide rather than fade. Adjust the whole of this block of code so it looks like the example below;
First I installed Pulse with the standard template on a temporary server. That works ok. I am able to create a new page with the standard template.
Then I made a freeway page, called it the same as the standard Pulse template (layout.php) and add the code as you desbribed above (I placed the 2 code behind each other in a Crownbar element).
Then on my server I replaced the standard Pulse folders:
layout.php / js / img / css for the folders belonging by my template: layout.php / css / resources (I have no js folder)
The result is a white page with something in the left corner like here:
Hi Erik,
This is one of those times when we need to help Freeway out with the template creation and, specifically, the file paths it uses. Freeway is happy to manage our file paths for us and it handles the paths to the css, js and image files (to name but three) perfectly. However when creating a template for a CMS like this the template is stored on one location (in the template folder) but is served from the domain root (http://pulse.graphicid.nl). The issue your page is facing is that all of the paths point to css/nieuw.css rather than template/css/nieuw.css.
The easiest way to rectify this is to apply the Remote Resources Action (http://www.freewayactions.com/product.php?id=013) to the page and enter template/ in the remote resources URL field. This will correct the URL and will rewrite the paths to work with your Pulse install. Previewing the page in Freeway or a browser will, however, look broken.
Regards,
Tim.