Page List Block Manual Parameters

Permalink
Hey guys,
I’m trying to make a page with some blocks embedded which can’t be edited or moved by users. I have got the search and autonav set up fine, however I need some help with the page_list block. I am trying to make a news feed panel.

I have changed the view to simply:
<?php 
   defined('C5_EXECUTE') or die(_("Access Denied."));
   $textHelper = Loader::helper("text"); 
   if (count($cArray) > 0) {
      for ($i = 0; $i < count($cArray); $i++ ) {
         $cobj = $cArray[$i]; 
         $title = $cobj->getCollectionName();
         echo    "<h3 class=\"news-title\"><a href=\"",$nh->getLinkToCollection($cobj),"\">",$title,"</a></h3>
               <div class=\"news-description\">",$textHelper->shorten($cobj->getCollectionDescription(),$controller->truncateChars),"</div>";
      }
   } 
   if ($paginate && $num>0 && is_object($pl)) {
      $pl->displayPaging();
   }
?>


Which is just the page_list view not including the RSS conditions. How can I change the fetch parameters of $cArray to be of the “News” page type only?

 
ScottC replied on at Permalink Reply
ScottC
easiest way is to set up a test site with the same db, add a page list showing the parameters for the site you want, then hardcoding those following manually coded in blocks elsewhere on the site.

In your code example the cArray is an araray of pages objects which are populated in the controller and passed to the block view, so editing here is kind of moot, either you bring it all to the view(bad idea) or you hardcode in the block via passing in the correct associative array of values.
TheServant replied on at Permalink Reply
Thanks Scott,
I will have a look at doing it that way, I had a feeling that the $cArray was specific and I would need to make a new array with req'd parameters.

I appreciate that c5 prides itself on editability, and that is why I am learning it, and will be providing solutions to my customers using it in the future, but is there any development in the area of EASILY including blocks in the theme templates?
TheServant replied on at Permalink Reply
I have been looking through as much as I can think of trying to find the "parameters" relating to this block, but they seem to be scattered throughout the 100 tables... Has anyone done this before and have any working code for something similar?
whereb replied on at Permalink Reply
whereb
Would you be able to accomplish what you want by using advanced site permissions and global blocks?
TheServant replied on at Permalink Reply
Sorry for the late reply, and thank you for yours. As far as I can see and know, there is no global blocks feature in c5, and if there was, yes, it would solve my problem.
RadiantWeb replied on at Permalink Reply
RadiantWeb
would adding the list block to your page_type defaults by editing it in the backend suffice?
TheServant replied on at Permalink Reply
If by backend you mean hardcoding, then yes.

After looking around some more, I might try some of the following:
http://www.concrete5.org/community/forums/customizing_c5/calling_a_...
http://www.concrete5.org/community/forums/customizing_c5/code-searc...
http://www.concrete5.org/community/forums/customizing_c5/scrapbook-...
http://www.concrete5.org/index.php?cID=28147...

Thanks for your help. It seems a very common problem of no easy way to add blocks to the whole site. Maybe if there was a global blocks area which you give a name and can put what ever blocks you want into, and then that area is uneditable except from the admin page, and add the block to your templates via the name you gave? Maybe it's a mod I need to make!