Customize Page List block-- add a title?
Permalink
I'd like to add a customizable title to a PageList block-- so that I can give the list a "name"-- that doesn't necessarily correspond with the name of a page in the tree ("Recent News", for a page list of news pages, etc.)
I've actually attempted to create my own package based on the PageList block, and I've been able to install it and even get the block form to reflect the field I'm looking for-- but I can't seem to get the form to write the new field data back to the database, or retrieve that piece of data.
I've based the package on the PageList block code, changing variable names and so forth.
But I think where I'm getting lost is in controller.php in the getPages() function-- where $plTitle is the name of the variable I want to store the title name:
I can't figure out how to get the $plTitle data into the $pl variable.
Tearing my hair out on this one.
I've actually attempted to create my own package based on the PageList block, and I've been able to install it and even get the block form to reflect the field I'm looking for-- but I can't seem to get the form to write the new field data back to the database, or retrieve that piece of data.
I've based the package on the PageList block code, changing variable names and so forth.
But I think where I'm getting lost is in controller.php in the getPages() function-- where $plTitle is the name of the variable I want to store the title name:
$plTitle = (string) $row['plTitle']; if ($plTitle != NULL) { } $num = (int) $row['num']; if ($num > 0) { $pl->setItemsPerPage($num); }
I can't figure out how to get the $plTitle data into the $pl variable.
Tearing my hair out on this one.
First, I did create a new package based on the Page List block, which I called "sidebar page list", because it's a block I only want to use in the sidebar.
Then, besides making sure that I was referencing the new block with a unique name in all of the important files (add.php, auto.js, edit.php, controller.php), I also made sure to do the following:
• create a field in db.xml with the name of the variable I want to use (ie. 'plTtitle'), and set that to a text or varchar type
• Added the input field to my sidebar_page_list_form.php file-- but I included it within the same
• And then in view.php and view.css I just set up the corresponding header and style where I wanted it-- and boom! A page list with a customizable title field.
:-D
Happy now. And I still have some hair left.