3. Editing Content



with perch installed we can start to edit our first content I'm going to start with the home page and there's this introductory paragraph here on the home page which I'm going to make editable the first thing I need to do is change my HTML pages into dot PHP pages perch needs PHP in order to run now it is possible to parse a dot HTML page as PHP on most web servers so you can have a look in our documentation about using other file extensions but let's keep things simple for now and just turn this to dot PHP you now we need to link in the perch runtime this is how we include perch in our page this is just a PHP include and we include the purge folder and then runtime dot PHP if you change the name of the purge folder perhaps to admin or CMS or something like that just make sure you also change the reference to it when you're linking to the runtime now we've done that we can scroll down and find the content we want to edit here it is we've got this div class main content let's just take that chunk of content and delete it now I'm going to add a purge region you another PHP tag there and we say perch content and inside the brackets you need to give this a name just think so we know what it is so this is the introduction so let's just call this intro and then save the page now if we go into the Krauser what I want to do is copy this content so we can quickly use that in the admin let's copy that and then reload the page and now that content has disappeared but also purch knows that we've put a perch region on that page so if we go here to manage content and reload the admin we can see the home page is appeared and we've gotten to regions a new region called intro and intro is what we called our region you click on home page now I've only got one region so it goes straight through to it I'm going to choose the default text block template hit submit and we get this text area with a little toolbar I paste in my content and by default we're using markdown here see it says down here markdown and the toolbar will insert markdown or you can just type it to anything familiar now you don't need to use markdown perché supports various WYSIWYG editor things like redactor and CK editor our default templates use markdown because we think it's quite a nice way to work with you want to use an HTML editor inside perch that's absolutely fine and you can install that so I've added some marked items and simple formatting there I can hit Save Changes and the contents are dated so let's go back to our page and reload and there it is that's now content managed content with perch

One thought on “3. Editing Content

Leave a Reply

Your email address will not be published. Required fields are marked *