Search the Community

Showing results for tags 'page field type'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Found 5 results

  1. Hello, I have a page field type (Multiple pages(PageArray)) with the input field type as AsmSelect. The admin users can select one or more pages from a list in the admin area. Some of those pages have children and if a checkbox is selected and the parent page has been added to the list, then I want to add the child pages as well on page save. So in admin.php I am trying to set those id's, but I can't get them to save. Hopefully the code clears up what I am trying to do. I appreciate any assistance. $pages->addHookAfter('save', function($event) { $pages = $event->object; $page = $event->arguments(0); //check if on template if($page->template == 'item') { //is the checkbox checked to add children if ($page->add_children == 1) { //get the values in the page field type field foreach ($page->page_assignment as $child) { //if selected pages have childen if ($child->numChildren > 0) { //loop through those children foreach ($child->children as $grandchild) { //set values. //$page->set('page_assignment', array($grandchild->id)) $page->page_assignment = array($grandchild->id); //we got the id of the page we need to s $pages->error($grandchild->id); } } } } }
  2. Hi all, I'm a newbie to PW but can definitely see the power and potential that it holds, but I have a question that I'd like your guy's opinions on to help steer me down the best path. I am working on a project to make a searchable catalogue of a certain type of dam, each one having in excess of 20 criteria that describes them, including name, owner, country, dimensions, construction dates, construction methods and statistics. I've imported the dam database into PW and it's created a Page called 'dams' with 497 children for all the dams (forgive me if I'm not using the correct terminology, as I say I am a newbie!). It's also created fields for all the different criteria. What I'm wondering is if this is the best way forward? When I take a look at the backend of the Skyscraper Demo site (which has the same kind of functionality that I'm hoping to employ) I see that there's separate pages for Architects and Cities. Is there a benefit in storing the information like this? Does it make the search functionality on the front-end more powerful or easier to create? Would it be best to have a separate page for Dam Owners and Countries for instance, or is having them simply as fields within the dam page enough to allow me to work with them easily? Thanks in advance for any help or advice you have to offer, and if there's any more information you need to know, just ask. Tony.
  3. Hello for all, I try to find solution for my problem but without success. I want to create selectable "widgets" option (banners) inside pages, and for that try to use Ryan "Blogprofile" principle: 1. create page widgets (hidden) with blank ("no file") template 2. inside page Widgets, child pages are different type of content (image+link, text box with some link, link lists etc...) 3. every "banner" has it's own template with markup Inside Home page I created page field type (asmSelect) and set that selectable parent template is "widgets". And all that works, no any problems with administration - I can select desired widget/banner. Because some desired eg. "Home" page doesn't know what kind of content is some widget (image+link, or text box with link, some list etc...) I use this in _main.php // _main.php $widgets = $page->widgets; if(!$widgets || !count($widgets)) $widgets = $homepage->widgets; foreach($widgets as $widget) { echo $widget->render(); // echo $widget shows correct ID } And some "banner" inside banner template has this (example): // banner.php $out = "<h4>{$page->title}</h4>"; echo $out; But I have problem that page (website) not load? Inside errors log ("site/assets/logs") I don't have any problem, everything is clean. My opinion is that I don't use correctly render() method??? My template structure is like latest PW (2.5.3) multilanguage profile. Thanks for any help.
  4. Hi all, I am trying to create a page field type that let the user choose a field among the list of the all the fields (to clarify: the list of fields under Setup > Fields), but I cannot make it work. I tried this: I created the field, I set the type to "Page", I went to Input tab and changed the attribute "Parent of selectable page (s)" : here I select "Home > Admin > Setup > Fields". The problem is if I go to the page the new field is there but the dropdown is empty, there are not values in it. Why? Is it because core pages like templates or fields are hidden by default? Any help is appreciated. Thank you!
  5. Hi, I am creating a simple blog section, I want to display categories on each blog post. For the categories I have created a page (hidden) called 'Categories' and for each category a child page under this: On my blog-entry template I have added a page field type called 'categories' which allows me to select multiple categories from my parent page shown in the image above. Is this the right approach? Just having trouble displaying the categories on my blog-entry template: <?php /** * Blog Entry * */ include("./head.inc"); ?> <h1><?=$page->title?></h1> <p>Date:<?=$page->date?></p> <p>Category:<?=$page->categories?></p> <div id='bodycopy'> <?=$page->body?> </div> <?php echo $page->comments->render(); echo $page->comments->renderForm(); ?> <?php include("./foot.inc"); I have applied 2 categories to this blog post my categories are being listed as '1034|1033' so obviously my code is not right. heres a link which shows this: http://www.hoof.net.au/pwire/blog/blog-entry-1/ Also, how do i go about having a list of category links which display those blog posts, would it require a new page template like an 'archive' blog posts template. I'm not sure how to approach this. thanks, Alex