setup script package like the sample content

Permalink 1 user found helpful
hi,
i'm new and trying out concrete5 to move from wordpress.
i want to write a package that can create custom attributes, page types, page templates, users, composer form sets, etc. similar like how the sample content was being set up when installing.

this is so that i can deploy the site easily.
the goal is so i can just install an empty concrete5 site, then install a package and voila! it is ready to use.
then i can make different packages for different purposes/projects

where should i look for a sample code to do this?
i have searched for 'programmatically creating page types' etc. but still kind of lost.
where is the php that generates the sample content that came with the install in the beginning?
is it available as a package? or is it built in the install script and cannot be installed later on after the install? (if sample content was not selected when installing)

thanks for your help!

xtedx
 
MrKDilkington replied on at Permalink Best Answer Reply
MrKDilkington
HI xtedx,

I am not sure if this is helpful or not. Hopefully it points you in the right direction.

"Concrete5 Content Import Format is used to describe the content and structure of entire Concrete5 sites"
https://www.concrete5.org/documentation/developers/5.7/designing-for...
xtedx replied on at Permalink Reply
xtedx
wow! looks like a good start. thank you! i will have a read and try to make a package of the sample content and install it to a blank site.
i just want to use the elemental theme for now.
xtedx replied on at Permalink Reply 1 Attachment
xtedx
the sample content generator doesn't work on 5.7, i downloaded the 5.7 branch from git, installed it, and when i run the get xml and get archive, i get a 404 error page.
the url ishttp://mba.local/concrete5/index.php/dashboard/generate_install_dat...

at the top of the page it has:
getFilesArchive(); $this->set('filesLink', REL_DIR_FILES_UPLOADED . '/tmp/' . $filesLink .
...snip...
Loader::helper('text'); $xml = $th->formatXML($xml); $this->set('outputContent', $xml); } } } }

which are the lines from the file
concrete5/packages/sample_content_generator/controllers/single_page/dashboard/generate_install_data.php (line 11 onwards)

i have no idea why this happens and couldn't find a way to fix it, i'm not familiar with concrete5/this framework enough

does anyone have the content.xml for a the sample site 5.7?
then i can try to do step 9 and continue.
maybe if there is a documentation on how to write this content.xml, like the syntax and methods to use?

UPDATE:
i found the xml file in here: <install_directory>/concrete5/concrete/config/install/packages/elemental_full/content.xml

i'm using 5.7.4

thanks.
jordif replied on at Permalink Reply
jordif
Hi,

the sample content generator is working fine for me.

It looks like your server is not processing the PHP file you mention (/packages/sample_content_generator/controllers/single_page/dashboard/generate_install_data.php)

That file uses short open tags, that could be the issue.

Could you change the first line from <? to <?php and see if that fixes it?

Regards,

Jordi
xtedx replied on at Permalink Reply
xtedx
aahh yeah, that's it. thanks jordi! that fixed it. i never used the short open tags.. i will remember this symptom from now.
xtedx replied on at Permalink Reply
xtedx
Thanks to MrDilkington and Jordi, I was able to create a package to install the sample content to a blank site, which will also allow me to install any content to a blank site.

Just to summarise what I did, if anyone is also trying to do the same thing:
1. Copied the directory <install_directory>/concrete5/concrete/config/install/packages/elemental_full/
2. Modified the elemental_full/controller.php file
At the top there it was originally using StartingPointPackage
, change them to Package instead.
namespace Concrete\Package\ElementalFull;
use Package;
class Controller extends Package
{
    protected $pkgHandle = 'elemental_full';
    protected $pkgContentProvidesFileThumbnails = true;
    protected $pkgAllowsFullContentSwap = true;
    protected $pkgVersion = '1.0';

3. The rest follows the guide for full content swap herehttps://www.concrete5.org/documentation/developers/5.7/designing-for...
, except that we don't need the content generator add on.
4. In step 9, we don't need to worry about dashboard (nothing about dashboard in it). Just use the content.xml as is.
5. Added a version number like above in my example.
6. Renamed the "files" directory to "content_files" and create an empty packages/your_package/elements/dashboard/install.php file.
The content of this install.php will be displayed just above the "Clear this site?" text when installing the package.
7. Go to extend c5 page to install it.

That's it, the sample content is imported.
MrKDilkington replied on at Permalink Reply
MrKDilkington
Thank you for including your steps, xtedx.
ianwilliams replied on at Permalink Reply
Hi,

My colleagues and I have only been using concrete5 for a couple of months. So we are all new to this.

We have experienced the same issues as described above. Initially they too were fixed by sorting out the php tags as stated.

However, now the generator page is produced correctly both the GO buttons generate a 404 error which was also mentioned above.


To confirm it wasn't something I'd done I've installed a fresh copy of concrete5 and installed the sample content generator. But the issue persists.

The issue appears in both my development environment (Netbeans 8.1 with Tomcat 8.0) and on the production server (IIS build 6.2 on Windows 2012). Both of these running PHP 5.6

I'm using the version 5.7.5.2 of concrete5 and the version of the generator from github that has been modified for 5.7


Do you have any suggestions please?