Hard code next prev block

Permalink 1 user found helpful
Hello.
I am wondering how to hard code this nice block into a template so it can't be edited or removed by an Editor.
Is there a way to do this ?
I am quite new to concrete5 and didn't understand all the relations between the different functions and classes yet.

Thanks for a hint.

Cheers,
pureTest

pureTest
 
mkly replied on at Permalink Reply
mkly
There is an addon called "Designer Content" by the prolific @jordanlev that works very well for simple blocks and as an intro to creating your own. Search for it in the marketplace. Good luck.
pureTest replied on at Permalink Reply
pureTest
Got that one already, thanks a lot.
Solved the problem with a stack though and limited the permissions to "read" for the editors of the pages.

Now I am wondering how to make the prev-next block loop through all pages, not only the ones on the same level.
Can't get it to work.
Do I have to create a new filter for that ?

Thanks again, mkly.

Cheers,
pureTest
nickratering replied on at Permalink Reply
nickratering
Yes you can add each block hardcoded in a theme:
<div id="prevnext">
<?php  
 $bt_main = BlockType::getByHandle('next_previous');    
 $bt_main->controller->nextLabel=t('next text');
 $bt_main->controller->previousLabel=t('previous text ');
 $bt_main->controller->parentLabel=t('show parent text');
 $bt_main->controller->showArrows=1; // set to 0 when false
 $bt_main->controller->loopSequence=0; // set to 1 if true
 $bt_main->controller->orderBy='display_desc'; // display_desc, display_asc etc...
 $bt_main->render('view'); // default block
 //$bt_main->render('templates/youtemplatename');
 ?>
</div>
pureTest replied on at Permalink Reply
pureTest
Thanks a lot nickratering.

Got that ;-).

pureTest
PatrickHeck replied on at Permalink Reply
PatrickHeck
I'd like to add one property, that can also be useful: linkStyle.
With this you can control if you would like to see the page name or "next" and "previous" links.

So the full example would be
<div id="prevnext">
<?php  
 $bt_main = BlockType::getByHandle('next_previous');
 $bt_main->controller->linkStyle='page_name'; // next_previous or page_name
 $bt_main->controller->nextLabel=t('next text');
 $bt_main->controller->previousLabel=t('previous text ');
 $bt_main->controller->parentLabel=t('show parent text');
 $bt_main->controller->showArrows=1; // set to 0 when false
 $bt_main->controller->loopSequence=0; // set to 1 if true
 $bt_main->controller->orderBy='display_desc'; // display_desc, display_asc etc...
 $bt_main->render('view'); // default block
 //$bt_main->render('templates/youtemplatename');
 ?>
</div>
chefia1 replied on at Permalink Reply
chefia1
Hi,
I do this. hard code with thumbnails (page atributte):

<?php
//initialize the block
$next_prev = BlockType::getByHandle('next_previous');
//set your options
$next_prev->controller->orderBy = 'display_asc';
$next_prev->controller->loopSequence = true;
$next_prev->controller->excludeSystemPages = true;
//get the pages
$prev_page = $next_prev->controller->getPreviousCollection();
$prev_title = $prev_page->getCollectionName();
if($prev_page->getAttribute('attribute_handle')) {
$prev_thumb = $prev_page->getAttribute('attribute_handle')->getVersion()->getRelativePath();
};
$next_page = $next_prev->controller->getNextCollection();
$next_title = $next_page->getCollectionName();
TeKnoZiz replied on at Permalink Reply
TeKnoZiz
Using Next/Prev on a Product Detail page in eCommerce, but it only goes to the first and last products. How come it won't cycle through them all?
bethanyb00m replied on at Permalink Reply
I was having this same issue and eventually realized that I needed to set orderBy to be display_asc.

$bt_main->controller->orderBy='display_asc';