block on every page

Permalink
Is there a way to to insert a block on every page or is such a behavior implemented by other parts of concrete (like template-functions in smarty)?

View Replies:
frz replied on at Permalink Reply
frz
yes. goto dashboard. goto page types there's a button next to each one that reads default content that'll take you to the c5 interface for that basic page. anything you add there should show up on every existing, and new, instance of that page type. neeto eh?
mannynz replied on at Permalink Reply
Yes very handy feature built into the CMS.

I'm still having some issues updating pre-existing pages. I've made a simple 'content' block - copied it to the 'scraps' and put that in my default page. Looks like newly created pages have the block but my existing pages do not.

It seems to work fine for the block elements that were already there ie the main image block on the plain yogurt theme. That updates existing pages great!

Anyone else have this problem?
ScottC replied on at Permalink Reply
ScottC
Go to page type, click, and you will see an option on the block to apply to children pages or something of that sort. This is an option by default only available when editing a pagetype.
bishopdennis replied on at Permalink Reply
bishopdennis
I'm having the same basic problem. Your solution MAY be my answer. However, this appears to add a block to that any page made with that page type. What if I have a block, that I've put on various page types. Now, say I want to change that block, and have it changed on every page that block appears, regardless of page type. I want to update the block once. Once updated, all other blocks are updated. When I did my sites with regular html, I simply had an includes folder that had certain text in it. When I updated that text file, all the pages read that ONE text file that I updated and "presto" ... all pages updated at once. (I may have just solved my own problem ... create a block with the html that links to a particular "include text" file.) I'm open to hear other options though. Thanks for any help and input.

UPDATE: I haven't figured it out on my own. An "include" code entry doesn't work. (Some of you need to stop laughing now, as you already knew that wouldn't work, but I didn't ... now I do.) LOL So, if anyone can help me, I'd appreciate it. Thanks.
Tony replied on at Permalink Reply
Tony
one option is to load and display a global scrapbook block based on its name:

<?
$block = Block::getByName('AnotherCollectionBox');
$block->display();
?>
agedman replied on at Permalink Reply
agedman
@bishopdennis: I like Tony's suggestion for some situations, but if you don't want to hard-code it into the templates, you can also do it this way:

Create the content in the global scrapbook, then edit the defaults for each page type that needs the block, inserting the block from the global scrapbook. This will actually be inserting an alias to the global block. So now, if you edit the global block, the changes will automatically show up on all appropriate pages.
miron replied on at Permalink Reply 1 Attachment
Hi,

I ran into an similar problem.

I just wanted to have an block which i implemented on my startpage returning on every subpage.

I wrote a tool which inserts an already existing block in an content area, here how it works:

In my themes folder i have wrapping elements like head.php and footer.php, so i want some contact information which i already added on my startpage to appear on every subpage, heres a mockup of my footer.php:
<div id="row_1_col_1">
<?php
  $kontakt_col1=new Area('Kontakt Kolumne 1');
$kontakt_col1->setBlockLimit(1);             $kontakt_col1->display($c);
  //only if the cID!=1
  if($c->cID>1){
    //place the autoBlock.php in your tools folder
    Loader::tool('autoBlock');
    //get the page with the existing block which you want to insert on every subpage
    $cHome=Page::getByID(1);
    //make an instance
    $ab=new AutoBlock($cHome,$kontakt_col1);
    //display the block content
    $ab->display();
  }


Hope it helps :)
LX666 replied on at Permalink Reply
If you happen to find this thread while looking for a global block/the block on every page, feel free to read on here:
http://www.concrete5.org/community/forums/customizing_c5/global-blo...

or for short:
<?php   
$a = new GlobalArea('Foot1');
$a->display($c);
?>