Global blocks - or how to get the same content on every page

kibmcz

Quote from: pcwacht on March 05, 2006, 01:22:18 PM
might be due to the code in your block1 page

try only an echo 'Hello world'; to test this.

John

Thanks that helped... it was the WYSIWYG module. it dosn't work in the global block. Not a prob as long as form module works (and it does).

pcwacht

might be due to the code in your block1 page

try only an echo 'Hello world'; to test this.

John

kibmcz

when i put <?php include (WB_URL."/pages/blocks/block1.php"); ?> in my template i am locked out of executing php in the current path (eg. http://www.yourdomain.com/)  for a random times. Yet my blog at /blog still worked ?


wwwMARKLEYcouk

Quote from: rabsaul on February 27, 2006, 11:03:27 AM
One thing you don't mention here is how to edit these blocks. Are they visible and editable from the Pages section of the Admin, or do they need to be edited manually?

Thanks!
they will show up in the pages section as number 3 states:

Quote from: pcwacht3 - make a new page
[url="http://www.markley.co.uk"]http://www.markley.co.uk[/url]

rabsaul

One thing you don't mention here is how to edit these blocks. Are they visible and editable from the Pages section of the Admin, or do they need to be edited manually?

Thanks!

pcwacht

What you need to do to make the 'globalblocks' work:

1 - the 'blank' template wich come with wb26x, it has only <?php page_content(); ?> in it's index.php, nothing more, this will be the template for the globalblocks
2 - make a menuitem 'blocks' and set it hidden (this will be the place to store the blocks)
3 - make a new page, 'block1', choose the 'blank' template for it, choose the 'blocks' page as parent and give it the content you want
4 - same as 3 for the second 'globalblock' and call this 'block2'
5 - change your current template's index.php by adding the two pages you just made

<?php include (WB_URL."/pages/blocks/block1.php"); ?> and
<?php include (WB_URL."/pages/blocks/block2.php"); ?>
at the position you want it.

What it does:
You made 2 pages, block1 and block2 and you choose the minimalistic template for it, so when you call those pages in your browser (http://yourdomain/pages/blocks/block1.php (or block2.php) you only will see what you entered, nothing more!

By including those two blocks in your template, the output will be placed in your normal pages at the place you have put the include-code.

That's basicly it.
Nothing fancy, nothing tricky, just using the system.

Benefits are:
one block for all pages
one time edit to change a block
much easier to admin
and it will show up in the search page (allso in the news-comments pages)