Create page by user with attributes?
Permalink
Hello,
It is possible when user submit a form, it will creates a page with specific attributes?
I know how to create a page but how to pass the values to attributes and assign them??
Any Ideas or suggestions?
Sorry if I am repeating the thread but couldn't find anything similar.
It is possible when user submit a form, it will creates a page with specific attributes?
I know how to create a page but how to pass the values to attributes and assign them??
Any Ideas or suggestions?
Sorry if I am repeating the thread but couldn't find anything similar.
no advice?
Hope the below post will help you.
http://www.concrete5.org/community/forums/customizing_c5/programati...
Rony
http://www.concrete5.org/community/forums/customizing_c5/programati...
Rony
Thank you Rony! :)
THis will add a new attribute to a page
Can you look at this code?
I get an error in MySql But I saw in Documentation this how you add a new page it seems to me cant find an error((
Thank you again!
THis will add a new attribute to a page
Can you look at this code?
$parentPage = Page::getByPath("/hotel"); $ct = CollectionType::getByHandle("products"); $data = array(); $data['cName'] = 'Test Page'; $data['cDescription'] = 'Description'; $newPage = $parentPage->add($ct, $data);
I get an error in MySql But I saw in Documentation this how you add a new page it seems to me cant find an error((
Thank you again!
Try this:
Rony
$pData = array('uID' => 1, 'pkgID' => 0, 'cName' => 'Test Page', 'cHandle' => 'testfive', 'cDatePublic' => '2013-07-02'); $oPage = Page::getByPath('/hotel'); $ct = CollectionType::getByHandle('products'); $newPage = $oPage->add($ct, $pData);
Rony
No Luck same error.
Make it sure that you have a page with the path "/hotel" as well as a page type handle called "products".
Rony
Rony
Ohhh I got It
Needed to load this guys))
ROny Thank you for spending your time to help me!!
One last question if you know how can I combine adding page and adding attribute.
I mean when I create page )
Loader::model('collection_types'); Loader::model('page'); $dt = Loader::helper('form/date_time');
Needed to load this guys))
ROny Thank you for spending your time to help me!!
One last question if you know how can I combine adding page and adding attribute.
I mean when I create page )
Problem Solved:
$dt = Loader::helper('form/date_time'); //current date $ct = CollectionType::getByHandle('Products'); // page type // array of data $data = array(); $data['uID'] = 1; $data['pkgID'] = 0; $data['cName'] = 'Page Name'; $data['cHandle'] = 'new_page_handle'; $data['cDatePublic'] = $dt->translate('cDatePublic'); // get by path parent page :) $page = Page::getByPath('/hotel'); $newpage = $page->add($ct, $data); $newpage->setAttribute('city', $city);