In putting together a site for my father-in-law, he wanted blocks, but
wanted to be able to edit them in the same way that he can edit pages.
I know the Pixie devs are working on this for a future release, but
instead of me having to manually update his blocks every time he
wanted to change something, I did a bit of exploring of the code, and
after about 20 minutes, I came up with a work-around "plan"...
Basically, I created a page with the slug of "block1". I then put the
content in that page, and removed it from navigation. Essentially, I
don't use that page as a page in the current Pixie sense - I just use
that page so that I can edit the content of the block. The "trick"
comes in with the special block files I created...
I created a block file (in the admin/blocks folder) called
block_block1.php - note that the bit after the "block_" and before the
".php" matches the slug for the page I created above. In a similar
way, if I wanted a second editable block, I'd create a page with the
slug of "mysecondblock" or whatever, and create another block file
called block_mysecondblock.php - so all you have to do to get this to
work is create a matching block file which uses the slug of the page
you want the contents from.
For all of the editable block_*.php files, the block contents is the
same - you can just copy the following code and put it in your own
block_<<your block content page slug>>.php file, and it should just
work. So, without further ado, here's the code to put in the PHP file
for this work-around to work... (copy everything from the <? to the ?>
inclusive and make sure there are no leading or trailing spaces or
lines around the code.
<?php
//*****************************************************************//
// Pixie: The Small, Simple, Site Maker. //
// ----------------------------------------------------------------//
// Licence: GNU General Public License v3 //
// Title: Editable block work-around. //
// Usage: Just create a page not in navigation, and then rename //
// this file to be "block_<<slug>>.php" where <<slug>> is //
// the slug of the page you want to use as the content for //
// this block. If you want more than one editable block, //
// create another page, copy this file, and rename it in //
// the same way. To edit the block contents, just edit the //
// page which serves the content (identified by the slug) //
// in the normal fashion. Enjoy. //
// Contributed by: Richard Tanner-Tremaine //
//*****************************************************************//
Just follow the instructions - i.e. create a page and remove it from
navigation, and then rename this file accordingly (replace "pageslug"
with the slug of the page you want to use for content).
> Just follow the instructions - i.e. create a page and remove it from
> navigation, and then rename this file accordingly (replace "pageslug"
> with the slug of the page you want to use for content).
> > Just follow the instructions - i.e. create a page and remove it from
> > navigation, and then rename this file accordingly (replace "pageslug"
> > with the slug of the page you want to use for content).
hy, first of all a big thank for all the developers and especially
drahcirtt who done that, i dont know if my post is good to be here but
after i apply what drahcirtt made i have something in mind that i
cannot do it and i need help if you are wiling to give it offcourse.
I wish if its posibile to extract this block of content like a simple
page i mean to have only the content on that page, because i want to
have a link to the page only with the content for showing her in a
popup lets say, do you think you can help me, i don;t know if i was
clear enough, sorry for my english, thanks
> hy, first of all a big thank for all the developers and especially
> drahcirtt who done that, i dont know if my post is good to be here but
> after i apply what drahcirtt made i have something in mind that i
> cannot do it and i need help if you are wiling to give it offcourse.
> I wish if its posibile to extract this block of content like a simple
> page i mean to have only the content on that page, because i want to
> have a link to the page only with the content for showing her in a
> popup lets say, do you think you can help me, i don;t know if i was
> clear enough, sorry for my english, thanks