Jump to content

Search the Community

Showing results for tags 'page'.

  • 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

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

  1. How can I programatically Save() to a Page Type field that contain multiple pages (PageArray)? This attempt fails with no error message, nothing is saved: $p = $pages->get(1234); $p->of(false); $p->foo = 4321; # Page Type field, I am trying to update the ID. // $p->foo = "bar"; // $p->foo->id = 4321; # Results in "Fatal error: Exception: Item 'id' set to PageArray is not an allowed type". $p->save(); Observation: It's hard to search documentation and forum entries for this topic because the keywords Page, Type and Save are frequently used in different contexts. I guess the most logical place to find information would be on 1) the "API Variable > $page" page - and/or, the "API Variable > FieldTypes" page. My request is that the documentation at some point will cover how to programatically CRUD each core field type (Checkbox, Datetime, Email, FieldsetOpen, FieldsetTabOpen, File, Float, Image, Integer, Page, Password, (Repeater), Text, Textarea, URL). Merry Christmas and thanks. Related: Create/Update a page programmatically
  2. in my page i store value of page by using page type field, field name is: page_side_menu when i call that field in template using $pid=$page->page_side_menu; echo $pid; i can see the page number but when i use bellow code i return me page title of home page not selected page. $pid=$page->page_side_menu; $paged=$pages->get($pid); echo $paged->title; why i am getting title of home page not page with id in $pid. Thanks
  3. i've searched this topic via google but didn't found anything... question is simple in a pagefield i get some entries (autocomplete, or multipageselect...) - is it possible to get a edit link on these pages link in the admin edit templatefield lists? i know there is the id given and with that i could code some js to get a link from that....but first ask if there was a proper methode or solution ready to use? a little screen for example: regards mr-fan
  4. Hi there! To allow something as simple as pagination with a little help of $_GET and math. With an additional selector offset, you should be able to get pagination easily done without extra modules. $limit = 10; $offset = $limit * $_GET['page'] - $limit; // page 1 = offset 0, page 2 = offset 10 $posts = $pages->find('template=news, sort=-created, offset='.$offset.' limit='.$limit); So far so good. The only thing missing is the markup: <div class="pagination"> <?php $pagination = $_SERVER["REQUEST_URI"].'?page='; ?> <a href="<?=$pagination.'1'?>">First</a> <!-- numbers --> <?php $amount = count($pages->find('template=news')); while ($i = 1; $i < $amount / $limit; $i ++ { ?> <a href="<?=$pagination.$_GET['page']+$i?>"><?=$i + ($offset / $limit) // 1 + 10/10 = 2 ?></a> <?php } ?> <a href="<?=$pagination.$amount?>">Last</a> </div> Kept very simple so far. But this is only one good example of how to use the offset selector. If there is already something like that implemented, I'd be glad to hear from it! Thanks in advance. Cheers, Martin Muzatko
  5. Hello ppl I'm trying to create an image banner to show in all pages of the site, and for this i created a page to hold multiple images in a field (latter im gonna deal with animating them). The page is published, So this is the tree of values i got: i can address the page with $pg_settings = $pages->get('name=settings'); it seem to be correct because print_r gets me a biiiig array if info now the problem is getting the array of images, with their respective url's. I tried: $pg_settings = $pages->get('name=settings'); // echo "<br />pg_settings: " . print_r($pg_settings->get("banners_slideshow")); // seems ok... $imgs = $pg_settings->get("banners_slideshow"); print_r($imgs[0]->get("url")); // i got nothing?? In this page i also have a non repeatable image field for the logo, so i think i cant use the images array from that page. the question remains: how do i address a field with multiples images, that is in another page? thanks for the patience!
  6. Hi, I'm trying to combine two find() arrays in a random order but currently can only make it give me back the same order each time. here's what im working with: $works = $pages->find('template=work'); $articles = $pages->find('template=article'); $works->prepend($articles); $randWorks = $works->getRandom(count($works)); foreach($randWorks as $child) { $class = $child === $page->rootParent ? " class='active'" : ''; echo "<a$class href='{$child->url}'>{$child->title}</a>"; }
  7. Sorry for that messy topic title but my problem seems very complicated to describe in so few words. So here a better description of my issue: I have a many product detail site under a parent called /overview/. On this product detail site is at the footer a listing of all the others product detail sites including the site itself. (all children of the parent /overview/. So i have for example: /overview/test1/ /overview/test2/ /overview/test3/ /overview/test4/ /overview/test5/ My Code look like this at the moment: <?php $overview = $pages->get("/overview/"); $overviewchildren = $overview->children("limit=4"); foreach($overviewchildren as $overviewchild) {?> <a href="<?=$overviewchild->url?>"><?=$overviewchild->title?></a> <?}?> Now on the site /overview/test1/ the code list show test1, test2, test3, test4. But i want that the child on which the user is at the moment dont show up at the list. So for the site /overview/test2/ the list should show test1, test3, test4 and test5. I hope you understand my problem , cause im from germany and to describe a php issue in english is very hard for me. Thanks a lot everybody for helping me.
  8. Hi, I want to delete 2 pages with $page->delete() after one another . But only one of the pages gets deleted. My code $serverpage = $pages->get($serverId); if ($action == "delete") { if ($serverpage->id) { $serverpage->delete(); //When I comment this out, $serverad further down gets deleted //if ads for that server exist, delete them $serverads = $pages->find("template=advertisement, ad_server={$serverId}"); if (count($serverads) != 0) { foreach ($serverads as $serverad) { if ($serverad->id) $serverad->delete(); //does not get deleted when $serverpage->delete() above executes. } $serverout .= "<div class='alert alert-success' role='alert'>All Ads for the server deleted.</div>"; } $serverout .= "<div class='alert alert-success' role='alert'>Server successfully deleted.</div>"; } else { $serverout .= "<div class='alert alert-danger' role='alert'>Server does not exist and could not be deleted.</div>"; } $serverout .= $serverForm->render(); } When $serverpage->delete() is executed, $serverad->delete() has no effect. When I comment out $serverpage->delete(), $serverad->delete() is working. I don't get any errors and I already checked that $serverad is a valid page object in all cases. Now I'm clueless of what the problem might be.
  9. Hi, I have add page field with categories to `user` template. In the processwire admin we can sort the page field items by dragging and moving the items. I would like to bring the same functionality to the front-end, so users can have a functionality to drag and drop. This can be saved via ajax rather than a save button. Would be helpful if anyone have done something like this. Thank you
  10. I may be missing something! How can I sort the order of items in a page field? I am pulling title data based on a template that is being used in a hierarchy, consequently the order is not optimal. Any ideas?
  11. Hi there I installed Processwire and like it very much. @community: Thank you! Everything works well, now I want to set up a multilingual site. Therefore I want to use the Module that comes with the installation. When I click to the «Modules» Tab a completely blank page is shown. In the Adminzone all the other Items are followed by a number – after «Modules» there is no such number: What can I do to get access to the modules? In .htaccess I had to comment the following Lines (If I let just one single line of these uncommented, I get a «500 – Internal Server Error» and Processwire doesn't work at all ): # Options -Indexes # Options +FollowSymLinks # Options +SymLinksifOwnerMatch # <IfModule mod_php5.c> # php_flag magic_quotes_gpc off # php_flag magic_quotes_sybase off # php_flag register_globals off # </IfModule> Thank you for your help.
  12. I have two page fields (PageAutocomplete) and I want to link them ... Templates: - Clients (Parent) -client (Childrens) -Field "Client_properties" (Page autocomplete select template=Property) - Properties (Parent) - Property (Childrens) -Field "Properties_client" (Page autocomplete select template=Client) What should I do?
  13. Hello, I've been reading about Cron & Lazy Cron for days, but since my knowledge of programming is fairly limited, I couldn't get a single task done, so I'm here again to seek some help, probably learn a thing or two. Firstly, Cron is task scheduler run by the server, right? And lazy cron is run by ProcessWire which runs only when page is loaded?? If lazy cron runs only when pages are loaded, how will it run periodically? My requirement is, on every first minute of a day, a specific page(which will contain some code to perform several tasks) should run. Since right now, the code doesn't need any specific time to run, I just run the page manually every morning. But there will be a time when it'll need to run at very specific time. I wish to know if this requirement can be fulfilled by Lazy Cron or will I also need to use cron? TL;DR I wish to know what's the difference between Lazy Cron & CRON? And when to use which? Also, I need to run a PW page specifically a minute after every midnight. Will it possible only with Lazy Cron or will I have to use Cron as well? For running URL instead of file in CRON, I'm looking at this solution by Horst.
  14. Not sure if I am approaching this right. Say I have a project page. Each project could have multiple organisations working on it. So I used a page fieldtype and this allows me to select the relevant organisation... if it exists. Then I saw that you could select the ability to add a new 'organisation' (page) in this case. This works fine if all I want to do is create a new organisation name, but how would I also add the other fields for the organisation like address, city, etc? As I said , I may be barking up the wrong tree, but any pointers appreciated.
  15. Hi! Is it possible to have multiple page with shared content where when I edit a page some page will also affect by that changes? Here is a sample tree stucture: -Home --Credit Card ---Newsletter --Widgets ---Social ---Newsletter On the example above. If I edit some fields on Newsletter then the chile page Newsletter on Widget is also affected. Is this possible?
  16. I've stumbled upon a weird issue with repeaters. I've created a repeaterfield with only a title field and assigned it to a template. When I create the first page everything goes well, but then when I'm creating additional pages I'm getting this error: ProcessPageAdd: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'for-page-23947-23799' for key 'name_parent_id' I'm not getting redirected (probably because of the error, but the page does get created with the RepeaterField correctly). The problem seems to exist in the file FieldtypeRepeater.module in the function 'getRepeaterPageParent'. I've modified the file to see what actually happens and it looks like the function doesn't find the required page of saves the page correctly. protected function getRepeaterPageParent(Page $page, Field $field) { $repeaterParent = $this->getRepeaterParent($field); $parent = $repeaterParent->child('name=' . self::repeaterPageNamePrefix . $page->id . ', include=all'); $this->message("L".__LINE__." | selectorresult: ".$parent->id); if($parent->id) return $parent; $parent = new Page(); $parent->template = $repeaterParent->template; $this->message("L".__LINE__." | template: ".$repeaterParent->template); $this->message("L".__LINE__." | parent: ".$repeaterParent->path); $parent->parent = $repeaterParent->id; $parent->name = self::repeaterPageNamePrefix . $page->id; $parent->title = $page->name; $parent->addStatus(Page::statusSystem); // exit early if a field is in the process of being deleted // so that a repeater page parent doesn't get automatically re-created if($this->deletePageField === $field->parent_id){ return $parent; } $parent->save(); $this->message("L".__LINE__." | looking for: ".self::repeaterPageNamePrefix . $page->id); $this->message("L".__LINE__." | current for: ".$parent->name); $this->message("L".__LINE__." | Created Repeater Page Parent: NAME={$parent->name} a " . $parent->path, Notice::debug); return $parent; } See the attachment for the output. IMO the second time FieldtypeRepeater: L574 | should output the previously created page... Anyone has an idea what's going wrong? I'm on the latest master branch.
  17. Hello, I'm trying to create a template that have a field for storing what user modified it. So when editing a page I could have a Single Selection for users. I used a page field with a parent of Users. but when I try to save it says " Page 3234 is not valid for owner" Thanks for any help.
  18. Let's say I've got a template with a field of a Page type. This field is set to handle multiple options (PageArray). Now, I want to select all pages using this template, that have specific page set in the PageArray field. Basically, something like this: $pages->find('template=x pagearrayfield.contains=page1') Is this possible? Any hints? Thanks in advance.
  19. How can I save a processwire page programmatically? That is, create a new page or update an existing page. I tried the code below in a \site\templates\article.php... <?php // CREATE PAGE - howto? // MODIFY PAGE // Page /foo/bar/ exists. $mypage = $wire->pages->get("/foo/bar/"); $mypage->title = "Foo Bar Test Page"; // Change the title. $mypage->save(); print_r($mypage); ?> ... and then called a page using the Article template: Error Exception: Can't save page 0: : Pages of type NullPage are not saveable (in \wire\core\Pages.php line 508) #0 [internal function]: Pages->___save(Object(NullPage)) #1 \wire\core\Wire.php(271): call_user_func_array(Array, Array) #2 \wire\core\Wire.php(229): Wire->runHooks('save', Array) #3 \wire\core\Page.php(869): Wire->__call('save', Array) #4 \wire\core\Page.php(869): Pages->save(Object(NullPage)) #5 \site\templates\article.php(10): Page->save() #6 \wire\core\TemplateFile.php(92): require('...') #7 [internal function]: TemplateFile->___render() #8 \wire\core\Wire.php(271): call_user_func_array(Array, Array) #9 \wire\core\Wire.php(229): Wire->runHooks('render', Array) #10 \wire\modules\PageRender.module(236): Wire->__call('render', Array)
  20. I'm working on a site with an about-the-team page where we have a sub-page for each different area of specialty. Each one of these pages will have a list of people who are in that specialty, this list built by pulling 'person' pages that were assigned to that specialty page through a page field. With me so far? Here's the fun part. I want to add a "level" to each of the people that show up on a specialty page. So let's say I'm on the Widget Managers specialty page, and I have the 'people' page field set to pull Alice and Bob to appear listed on this page. But I want Alice to be a 'senior' widget manager and Bob to be a 'junior' widget manager. I could just put a field in the Person page type that lets me set that person's level, but wait! A person can be assigned to more than one specialty page, with different levels on each one! So Alice might be a senior widget manager and a junior doohickey wrangler. She has to show up on the widget managers page as senior, and on the doohickey wranglers page as junior. Ideally, I'd have a repeater field containing two page fields, one to select a person and one to select their level on the current specialty page, but repeaters can't contain page fields. Anyone know of a way I might approach this?
  21. Hi, I'm currently working on an event website. Each event has 1 or more children containing among others a datetime field. (Each child is a different day in a different place) I would like to move the event page (with its children) to a folder called "past events" once they're history. Anybody have an idea of how to do this? I'm lost here. Thanks a lot.
  22. Plase correct me if something is wrong, I'm still learning the processwire way xd. According to the API Docs http://processwire.com/api/variables/page/ $page->path The page's URL path from the homepage (i.e. /about/staff/ryan/) $page->url The page's URL path from the server's document root (may be the same as the $page->path) So I have to migrate a site from development to production server and all the links were messed up. Why? Because I was using $page->path for redirects. Changed redirects to $page->url and Presto! everything works fine. And, When to use $page->path? Use $page->path when importing other page. example $people = $pages->get('/system/people'); $friend = $pages->get($people->path . $input->urlSegment1); Use $page->url when you need a redirect $session->redirect($friend->url);
  23. output page filter by roles, output in admin and other areas, all good! on Change select page "Page 1022 is not valid for manager" Custom selector to find selectable pages > roles=manager
  24. Hi Guys, So I have a template lots of articles . Approximately 23559 pages . I have a field article_id in say example template which is of type of PageArray to the articles template. Now when you try to load that particular template ( example ) PW is becoming slow.... And yes another server we have around 293363 pages and this can grow. So what is the best way to get much speed, or say the PageArray not to load all the stuffs for this is mainly used from an admin point of view. Any suggestions is welcome. Thanks
  25. I am developing a little app for my university to pass it, the problem is to count some number, i used field page for select stuff in my Template AddProject i have 4 fields beside name and title template AddProject with field ------- Field "SelectUSer" (user1, user2, user3) this field / page / Single page (Page) or boolean false when none selected ------- Field "SelectStatus" (Active, Inactive) this field / page / Single page (Page) or boolean false when none selected ------- Field "SelectProf" (Name, Name2, Name3) this field / page / Single page (Page) or boolean false when none selected ------- Field "SelectSource" (10,20,30,40,50,60,70,80,90,100) this Field is Select not page and i have a page when i list projects ListProject ----------Project 1 ------------Field "SelectUSer" (user1) ------------Field "SelectStatus" (Active) ------------Field "SelectProf" (Name) ------------Field "SelectSource" (20) ----------Project 2 ------------Field "SelectUSer" (user2) ------------Field "SelectStatus" (Active) ------------Field "SelectProf" (Name2) ------------Field "SelectSource" (50) ----------Project 3 ------------Field "SelectUSer" (user3) ------------Field "SelectStatus" (Active) ------------Field "SelectProf" (Name3) ------------Field "SelectSource" (80) i want to query Project 1 | User1 | Active | Name | 20 Project 2 | User2 | Active | Name2 | 50 Project 3 | User3 | Active | Name3 | 80 also query for user to grab field related to user and page user1 | Active | and Field SelectSource to get number from pages which have selected user1 or other user
×
×
  • Create New...