1

I've created a biography block for concrete5. I need a script to execute only once on pages that contain this block, I can't figure out how to add the script in. The view.php doesn't make sense because I only want it to execute once per page not once per block. Any Ideas?

Edit:

More specifically, I've created a block that has a picture on the left and a bio on the right. I want this to switch every other block so that it has better definition and an easier to follow page layout. I've written a script that will do this:

$(function(){
    jQuery(".bio-block:nth-child(even)").each(function() {
        var id = $(this).attr('id');
        if (id != null){
            jQuery("#"+id+" > .bio-image").before(jQuery("#"+id+" > .bio-text"));
        }
    });
});

But I need it included once after the page has loaded on each page that has bio blocks. There are multiple pages, one page for each team: marketing, sales, management, etc.

1
  • Couple of things: (1) Look for the "Php block by ND" in the MarketPlace. (2) How about using linked pages? Select the block in question.. Choose copy to clipboard.. Go to the destination and choose paste. Caution: if you edit the destination page - you break the link.
    – Leptonator
    Commented Nov 16, 2013 at 6:52

2 Answers 2

2

concrete5 blocks have a view.js file: blocks/my_block_handle/view.js This will be automatically included once and only once, no matter how many of the same block you have on a page.

0

Hard to say without knowing more details of your situation, but it sounds like you probably want a single_page instead of a block. See http://www.concrete5.org/documentation/developers/pages/single-pages for more info.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.