Understanding Single Pages in Packages (how to install theme specific single page)

Permalink
I'm creating a custom theme package that requires a "theme specific" single_page... referring to the official documentation:
---
"If you need more flexible control over a single page within a particular theme, just include a file with the same name as your single page within the theme itself.
That entirely file will be used as the single pages template, including the header, footer, etc... It can completely override the single page, too.
(So, in our example above, once we have "my_profile" added as a single page, add "my_profile.php" to your active theme. This template will then be used instead of the single page." - c5 docs
---
So how do you do this from within the package's controller file?

Here is the code I'm using to create the single page:
//myPackage/controller.php
   Loader::model('single_page');
      $sp = SinglePage::add('/style_guide', $pkg);
      $sp->update(array('cName'=>t("Style Guide"), 'cDescription'=>t("Site design style guide.")));


This newly created single page will only be picked up when I manually copy the single page file, in this case "style_guide", into the root/single_pages/ directory.

I've found some info here (filed under bugs?):
http://www.concrete5.org/developers/bugs/5-4-1-1/install-single-pag...

, but at this point I'm a little confused as to how to work with single_pages that are "theme specific" since in testing in order for the theme specific single_page to be picked up by c5 I had to always copy the file first to the root/single_pages/ directory... for some reason it won't work without a file in there first... then an over-ride file placed in the theme folder with the same name.

The funny thing is, once c5 makes the link to the over-ride file in the theme folder the root/single_pages/ file is no longer needed and can be deleted. Would be nice to eliminate this step of manually copying the file over just to install the "over-ride" version of it stuffed in my theme folder... but since wishing in one hand pretty much produces ... well, we know what in the other...

...so I guess my question is, can you install a theme specific single page from within the package installer and if so, any suggestions as to how :)

MrNiceGaius
View Replies:
MrNiceGaius replied on at Permalink Reply
MrNiceGaius
update - installing a "root" level single page with in a package works but the "theme specific" single page still will not load.

Root Level Single Page (installs correctly)
packages/myPackage/single_pages/custom_page.php

Theme Specific Single Page (no workie)
packages/myPackage/themes/myTheme/custom_page.php

... so this leads me to believe that "theme specific" single pages are not supported in packages?
nerdess replied on at Permalink Reply
nerdess
Hello there

I am having a similar issue.

I've created a single page inside my theme controller like so:

$sp = SinglePage::add('/work', $this);
$sp->update(array('cName'=>t('Work'), 'cDescription'=>t('Present all work')));


($this refers to the theme handle)

Now I got no clue where the controller file for it is supposed to go, no matter where i put it it doesnt get picked up.

ODDDLY ENOUGH tho when i create a single page called "/dashboard/blabla" for the DASHBOARD inside my theme it works all perfectly fine!

The controller can be found inside
packages/theme_dir/controllers/dashboard/blabla.php

The view can be found inside
packages/theme_dir/single_pages/dashboard/blabla.php

This is so strange!
nerdess replied on at Permalink Reply
nerdess
Also I get this error as it expectes the view to be default.php (why? why not work.php?)

File C:/xampp/htdocs/xxx/concrete5/packages/theme_addiction/themes/xxx/default.php not found. All themes need default.php and view.php files in them. Consult concrete5 documentation on how to create these files.


**************
Solution: It was a caching issue! I had to go to dashboard -> single pages and hit the "refresh" button next to the single page.
**************