Concrete 5.7 addon development
Permalink$page1 = SinglePage::add('/dashboard/my_custom_texts', $pkg);
$page1->updateCollectionName(t('My custom List'));
$page2 = SinglePage::add('/dashboard/my_custom_texts/my_custom_textscat', $pkg);
$page2->updateCollectionName(t('My Category List'));
In concrete/packages/my_custom_texts/controllers/single_page/dashboard/my_custom_texts/my_custom_textscat.php
I have written
<?php namespace Concrete\Package\MyCustomTexts\Controller\SinglePage\Dashboard; use \Concrete\Core\Page\Controller\DashboardPageController; use Loader; use \Concrete\Package\MyCustomTexts\Src\TextcatPageList; defined('C5_EXECUTE') or die(_("Access Denied.")); class MyCustomTextscat extends DashboardPageController { public $helpers = array('form'); public function view() { $ctextList = new TextcatPageList(); $ctextList->setItemsPerPage(25); $paginator = $ctextList->getPagination(); $pagination = $paginator->renderDefaultView(); $this->set('textslist',$paginator->getCurrentPageResults());
In concrete/packages/my_custom_texts/src/Textcat.php
I have written
<?php namespace Concrete\Package\MyCustomTexts\Src; use Concrete\Core\Foundation\Object as Object; use Database; use Concrete\Package\MyCustomTexts\Src\TextcatArrayList; defined('C5_EXECUTE') or die(_("Access Denied.")); class Textcat extends Object { public static function getByID($sID) { $db = Database::get(); $data = $db->GetRow("SELECT * FROM btmycustomtextcat WHERE sID=?",$sID); if(!empty($data)){ $ctext = new Textcat(); $ctext->setPropertiesFromArray($data); }
In concrete/packages/my_custom_texts/src/TextcatPageList.php
I have written
<?php namespace Concrete\Package\MyCustomTexts\Src; use Database; use Concrete\Core\Search\Pagination\Pagination; use Concrete\Core\Search\ItemList\Database\ItemList as DatabaseItemList; use Pagerfanta\Adapter\DoctrineDbalAdapter; use Concrete\Package\MyCustomTexts\Src; use Concrete\Package\MyCustomTexts\Src\Textcat; class TextcatPageList extends DatabaseItemList { public function createQuery() { $this->query ->select('t.sID') ->from('btmycustomtextcat','t') ->orderBy('sortOrder', 'ASC');
In concrete/packages/my_custom_texts/src/TextcatSingleList.php
I have written
<?php namespace Concrete\Package\MyCustomTexts\Src; use Database; use Concrete\Core\Search\Pagination\Pagination; use Concrete\Core\Search\ItemList\Database\ItemList as DatabaseItemList; use Pagerfanta\Adapter\DoctrineDbalAdapter; use Concrete\Package\MyCustomTexts\Src; use Concrete\Package\MyCustomTexts\Src\Textcat; class TextcatSingleList extends DatabaseItemList { public function createQuery() { $this->query ->select('t.sID') ->from('btmycustomtextcat','t') ->orderBy('RAND()', 'DESC')
But in view
concrete/packages/my_custom_texts/single_pages/dashboard/my_custom_texts/my_custom_textscat.php
when I am writting
<?php foreach ($textslist as $tl) : ?> <?php echo($tl->sID)?> <?php endforeach;?>
It is showing error Invalid argument supplied for foreach().
Need help to fix this.

In concrete/packages/my_custom_texts/controllers/single_page/dashboard/my_custom_texts/my_custom_textscat.php I wrote
public function view() { echo "Show my custom texts";
even that is also not displaying.