changing dashboard after package install

Permalink
Hi, I have been building a package for a site that I am working on. Had some help and learning from this forum. But one of things that I thought would be the simplest - is not working. I have a folder structure that is like this -

controller/dashboard/teams
teams being teams.php ( controller file)

and another in single_pages/dashboard/teams
again teams is teams.php ( single page )


controller/dashboard/teams/add
add being add.php ( controller file)

and another in single_pages/dashboard/teams/add
again add is add.php ( single page )

Anyway I registered these as single pages in package install. And they work

But on the dashboard it is creating only one link ( the add ) and the teams is the panel around it. So I tried to install a single page (list) and just have it redirect to the team which is actually the list. Here is the problem - if I try to do this in the dashboard - pages and Themes - single pages. Where the list is I fill in
dashboard/teams/list
which points to my list.php file - I get the error-
"That specified path doesn't appear to be a valid static page.That specified path doesn't appear to be a valid static page."

Is there something strange because of the first part of the path which is on a local server? Can't get it to work. Also I see that in other packages people are adding single_pages different ways. Which is the best way to register on install?

INTcommunications
 
hutman replied on at Permalink Best Answer Reply
hutman
If you structure your package like this

/controllers/dashboard/teams/controller.php
/controllers/dashboard/teams/list.php
/controllers/dashboard/teams/add.php
/single_pages/dashboard/teams/view.php (blank)
/single_pages/dashboard/teams/list.php
/single_pages/dashboard/teams/add.php

Then in the /controllers/dashboard/teams/controller.php have this
<?php 
defined('C5_EXECUTE') or die("Access Denied.");
class DashboardTeamsController extends Controller {
   public function __construct() { 
      $this->redirect('/dashboard/teams/list');   
   }
}
?>


And to add the Single Pages when you package is installed I usually use this for each of the single pages I am installing
$teams = SinglePage::add('/dashboard/teams', $pkg);
if (is_object($teams) && !$teams->isError()) {
   $teams->update(array('cName' => t('Teams'), 'cDescription' => t('Manage Teams')));
}
$teams_list = SinglePage::add('/dashboard/teams/list', $pkg);
if (is_object($teams_list) && !$teams_list->isError()) {
   $teams_list->update(array('cName' => t('List'), 'cDescription' => t('List Teams')));
}
$teams_add = SinglePage::add('/dashboard/teams/add', $pkg);
if (is_object($teams_add) && !$teams_add->isError()) {
   $teams_add->update(array('cName' => t('Add'), 'cDescription' => t('Add Teams')));
}


In the Dashboard then the Header of the section is called Teams and then there are List and Add options inside the section.

I hope this helps.

This website stores cookies on your computer. These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media. To find out more about the cookies we use, see our Privacy Policy.