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. Hello guys, I have a Page field for my own global media gallery. When I select one page, I get following PageArray via the API: object(ProcessWire\PageArray)#287 (7) { ["hooks"]=> array(2) { ["PageArray::render"]=> string(60) "MarkupPageArray->renderPageArray() in MarkupPageArray.module" ["PageArray::renderPager"]=> string(56) "MarkupPageArray->renderPager() in MarkupPageArray.module" } ["count"]=> int(3) ["items"]=> array(3) { [0]=> string(29) "/files/unpublished/" [1]=> string(25) "/files/animals/" [2]=> string(23) "/files/sloth/" } ["total"]=> int(3) ["start"]=> int(0) ["limit"]=> int(0) ["selectors"]=> string(0) "" } So I select 1 Page and get 3 Pages in return? How can this happen? From the interface here, everything looked fine: Here is the stuff that created the field (if needed): $data['getFileField'] = new Field(); $data['getFileField']->type = $this->modules->get('FieldtypePage'); $data['getFileField']->name = 'fooBar'; $data['getFileField']->label = $this->_('File select'); $data['getFileField']->parent_id = $files['page']->id; $data['getFileField']->inputfield = 'InputfieldPageListSelect'; $data['getFileField']->labelFieldName = 'title'; $data['getFileField']->allowUnpub = 1; $data['getFileField']->description = $this->_('Select one file or folder. If folder is selected, the first file inside of it is used.'); $data['getFileField']->icon = 'file-o'; $data['getFileField']->save(); Is this a bug? EDIT: Now I am pretty sure it is a bug in PW (3.0.10): If I select a page via the Page field, the PageArray is only with this page. If I change the page via the Page field (and save), I get the old one plus the new one. So somehow it does not get reseted on new selection.
  2. Hey All. I am trying to change the label of a field after a certain page is saved. This field is not part of the page that is saved but the label should be updated with the page name. $pages->addHookAfter('saved', function($event) { $page = $event->arguments[0]; if($page->template->name == 'service-type') { $cid = $page->id; $this->message($cid); /* find field servicetype_rangeslider_$cid and set label */ // how to access $fields?? } }); I have this hook in my /site/ready.php. Now my remaining problem is, how to access $fields array or in general, how to get the field? I am thankful for every hint, thanks!!
  3. Hey all. I have a question concerning templates and a possible setting to disallow/prohibit to view pages that are using certain templates. I have a couple of templates that are not complete page-templates including header/footer but are sections-templates. E.g. I have a template called 'Case' and every page using this template can add section children, e.g. first a section-video, then section-textblock, ... Doing this, the user can create its own cases out of building blocks. However, up to now one can select 'view' in the page-tree in the admin panel to view each sections. This view failes, as they don't have a header/footer. Can anyone of you think of solution how to disable that one can view pages with template section-* ? Thanks a lot in advance!
  4. Hi, I'm working on a script that allows users to add a new Page to my installation of ProcessWire. I will explain how this script works below. The user enters some information into a simple form ^ This can include an image The form is validated with jQuery When valid, the form triggers a function through a class that handles the process I will include some of the code below. Form: <form id="entry" class="entry" method="post" action="./" name="entry" enctype="multipart/form-data"> <div class="row"> <input type="text" name="fullName" id="fullName" placeholder="Naam initiatiefhouder *" data-validation="required" /> </div> <div class="row"> <input type="text" name="projectName" id="projectName" placeholder="Projectnaam *" data-validation="required" /> </div> <div class="row"> <input type="email" name="emailAddress" id="emailAddress" placeholder="E-mailadres *" data-validation="required" /> </div> <div class="row"> <textarea name="projectDescription" id="projectDescription" placeholder="Beschrijf uw initiatief *" data-validation="required"></textarea> </div> <div class="row"> <input type="file" id="image" name="image" data-validation="mime size" data-validation-allowing="jpg, jpeg, png, gif" data-validation-max-size="2M" /> </div> <div class="row"> <input type="submit" name="submitEntry" id="submitEntry" value="Insturen" /> </div> </form> So basically the "image" field is the field that allows the user to add a file (jpg, jpeg, png, gif - max 2mb). Now, when all the information is valid it will post this form through the following function. public function pushEntry ($input, $file) { // Unset the array $this->array = []; // If there is any data if ($input) { // Get some of the variables needed $this->name = $this->sanitizer->text($input->fullName); $this->email = $this->sanitizer->email($input->emailAddress); $this->project = $this->sanitizer->text($input->projectName); $this->description = $this->sanitizer->text($input->projectDescription); // Get the date $this->date = date("d-m-Y H:i:s"); // Generate the title $this->title = "$this->project - $this->name"; $this->duplicate = $this->pages->find("title=$this->title"); // Generate the array $this->array = [ "title" => $this->title, "fullName" => $this->name, "emailAddress" => $this->email, "projectName" => $this->project, "projectDescription" => $this->description, "date" => $this->date ]; // Create the page $new = new Page(); $new->template = $this->templates->get("entry"); $new->parent = $this->pages->get("/entries/"); foreach ($this->array as $key => $value) { // Foreach key and value, create a new page $new->$key = $value; } // Check if there is any duplicates if ($this->duplicate->count() == 0) { $new->save(); } else { echo "Dit initiatief bestaat al."; exit; } // If there is an image if (!empty($file["image"]["name"])) { // Some variables $this->path = $this->config->paths->assets . "files/$new->id"; // Set the extensions $this->extensions = [ "jpg", "jpeg", "png", "gif" ]; // Do the Wire $this->image = new WireUpload($file["image"]["name"]); $this->image->setMaxFiles(1); $this->image->setOverwrite(false); $this->image->setDestinationPath($this->path); $this->image->setValidExtensions($this->extensions); // Execute and check for errors $files = $this->image->execute(); // Add the image to the page $this->fileName = $file["image"]["name"]; $this->fullPath = $this->path ."/". $this->fileName; // Move the file $new->image->add($this->fullPath); // Unlink the file unlink($this->fullPath); // Save the page $new->save($new->id); } } // Return the array return $this->array; } The script adds a page to my installation of ProcessWire perfectly; except for the file upload. I encounter the following errors; Warning: unlink(C:/wamp/www/gezondsteregio/site/assets/files/1135/dekkleden_header.1919x301.jpg): No such file or directory in C:\wamp\www\gezondsteregio\site\templates\controllers\home.php on line 106 Warning: filemtime(): stat failed for C:/wamp/www/gezondsteregio/site/assets/files/1135/dekkleden_header.1919x301.jpg in C:\wamp\www\gezondsteregio\wire\core\Pagefile.php on line 324 Warning: filemtime(): stat failed for C:/wamp/www/gezondsteregio/site/assets/files/1135/dekkleden_header.1919x301.jpg in C:\wamp\www\gezondsteregio\wire\core\Pagefile.php on line 324 I am really curious if someone can help me with this problem. I have tried this script on both my localhost (regular Apache) and my webhost (Fast CGI). Regards, Jim Oh, and I use the following script to trigger the function. $entry = new Entry(); // If there is a post if ($input->post->submitEntry && !empty($input->post->fullName) && !empty($input->post->emailAddress) && !empty($input->post->projectName) && !empty($input->post->projectDescription)): // Push the entry to the controller $entry->pushEntry($input->post, $_FILES); endif;
  5. I have a page that has a field that contains a page. How do I use the API to update a page select field in the page's page? Example: User page has field "member" which points to a member page. Member page has field "gender" which points to page for selecting gender. How do I change the page the gender points to from the user page? I've tried $user->member->gender = 123; where 123 is the new page ID. Also, $user->member->set("gender", 123); Both of these seem not to work.
  6. Hi, I've been using PW for a pretty long time now, and this kind of thing is happening for the very first time. I'm setting up an API for the App I'm creating for my client. So I've created a hidden page called API which is located right under the Home. When I'm trying to write code for API and test it, the output is only visible for logged in user, i.e., the output is only available if I'm logged in, which is not going to be the case when I'm using app to request JSON. So, question is, how to keep the page hidden but accessible to guest user? I checked the permissions under settings tab. Who can access this page? Tab says it's accessible to guest & superuser but for some reason, it's only working for superuser. What am I doing wrong? Thanks.
  7. I have a page field calles select_multi_dates. I set a php specific selector like this $currentActivity = $page->parent; return $currentActivity->activity_create_date; It shoud give me all pages from the activity_create_date pagetable, what it does well but the problem is that the label is shown as timestamp. And here is the configuration of the page field: What I'm missing?
  8. Hi folks, I have a simple PageField set up, which is being used in this instance as a 'Related Articles' area; they can choose (Multiple Pages) which news articles are related then it does something nice front end. The only issue I have is that I'd like to limit the number of articles they can choose (only allowing three, for example) much like you would have in a File field or Image field (Maximum files allowed). Any thoughts?
  9. Hi all, friends. Still here to fight against problems I can't figure out (yet ). I've looked for a solution into the forum but seems I'm not able to find the solution, still. I'm finding myself to fight with this weird issue where I've users with (finally) correct permissions to access and edit the pages they created, then I've have some fields in my template (which I want my users are able to create from the field directly) where parent and template (and selectors for having ordered items to choose from) are correctly set up (I think), but for some weird reason I can't create pages (the link doesn't appear as it should) from these fields. Already tried to adjust permissions for roles and fields, but with no positive results. Hope in your help (as usual )
  10. I appreciate all the help thus far in learning how to navigate Processwire. However, I have hit a road block. I have an Image Field in one of my templates (it is being used in a repeater), and I would like to assign a preexisting page's url to the image . Ie: <a href="url-to-page"><img src="code-for-image" /></a> However, maybe I have missed something, as I set up the field (homepageImg) to be a "page select" but nothing is currently populating the dropdown. I am merely trying to get all the children of the parent (that the current page is in) and display them. I thought this would make it easy for someone to set the URL on the fly. Any help would be appreciated.
  11. I want to set the pagestatus of a admin-page to hidden when a user is logged in which has the role "company". I did this in the admin.php but it doesn't work. What I am missing? if(wire('user')->isSuperuser()){ $pages->get(1265)->removeStatus(Page::statusHidden); } else{ $pages->get(1265)->addStatus(Page::statusHidden); }
  12. Is it possible to make a "Add New" Shortcut-Button on a Custom Admin Page e.g in the ProcessDashboard Module instead on the Sitetree Page?
  13. Hi, I've noticed the following entries in my PW error log SQLSTATE[HY000]: General error: could not call class constructor [pageClass=Page, template=] The following is the associated link that is logged as well. http://localhost:8888/processwire/page/list/?id=id&render=render&start=start〈=lang&open=open&mode=mode Any ideas where I can look to get to the bottom of this?
  14. Hi there, I was wondering if there is anyway of getting some basic page stats (like number of times a page is visited etc) without having to resort to 3rd party tools like Google or other analytics tools? Are there any built-in-tables or logs that keeps this information? Thanks in advance.
  15. I have a template called "activity" with two pagetable fields. Fields: activity_create_cast activity_create_date activity_create_cast: uses "cast" template for creating castpages. the cast template contains a pagefield called select_multi_dates. activity_create_date: uses "date" template for creating datepages. the date template contains a pagefield called select_activity. Now what i want is create a cast with activity_create_cast and I want that the selection of the select_multi_dates pagefield should be the pages wich i created before with the activity_create_date. How can I achieve this under the select_multi_dates pagefield with a PHP-Selector? I know its complicated PHP-Selector. Hope you can help me. Thanks for your attention. Nukro
  16. Is it possible to delete and edit pages from the frontend? Because I know its possible to create pages via the API from the Frontend. Even when the user role only has view permission and not edit permissons. creating pages: https://processwire.com/talk/topic/352-creating-pages-via-api/ https://processwire.com/talk/topic/3105-create-pages-with-file-upload-field-via-api/
  17. I'm trying to achieve a specific selection for a pagefield for specific users. My pagefield should detect: If the current user is a superuser return all address-pages and when it's not a superuser, return all address-pages which the current user has created. It works fine for the superuser but i have no selection in all the other users. if(wire('user')->isSuperuser()){ return $pages->find("template=address"); } else{ return $pages->find("template=address, created_users_id=wire('user')->id"); }
  18. I have the problem that i cant render a fredi link to a page which i choosed from a pagefield from a user. i have a user called "test-user". This "test-user" template has a pagefield called select_organiser which contains all the organiserpages. My approach: $organiser = $user->select_organiser; <li>'.$fredi->setText("<i class='fa fa-pencil'></i> Veranstalter bearbeiten")->renderAll($organiser).'</li> What I am doing wrong?
  19. Hi, How do you implement a holder/page pattern in Processwire. The idea is simple. One page type manages the list view, and usually contains very little native content. The primary function of this page is to provide a list of its child pages, providing a brief summary for each one, along with a link to its detail view. A second page type will represent the detail view for any given child page, which will typically have a custom template and content fields that make up its identity. Think of it think like a news listings, image galleries, even a Twitter timeline.
  20. I need to save order for elements in global tree after using "page" fieldtype in other page. It's better to look on image attacheted to understand. I wish to know the better and easiest way to solve it or <code> example ! Thanks
  21. Hi there, This is a follow up question from my Page/Category question. https://processwire.com/talk/topic/10738-categories-not-visible-incorrect-setup/ I have a reference to the Category page I want to test membership for : $catgoryPage = $pages->find("parent.id=[path=/categories/, include=unpublished], title=$category"); I want to test if a particular page's field, Category (type:Page Fieldtype) == $categoryPage. I've been trying for the last hour on how to test membership for this page object without any success. I have tried 1) using the find method but I'm not sure how I can describe a field category == $categoryPage 2) looping through a PageArray, get the fields Array and using the has method on it. $testPages->fields->get("category")->has($categoryPage) 3) I have tried to search the forums but have found none related to my issue. Am I approaching this problem incorrectly or is there a simple answer to this? Thanks in advance
  22. In my home.php (a template, as you'd expect for the homepage) then I take a look at the URL segments. I want to provide some shortlinks, e.g. example.com/php redirects to example.com/languages/php/. That all works. But if I want to display a 404, by using "throw new PageNotFoundException();" then things go pearshaped: Fatal error: Cannot redeclare renderNav() (previously declared in /var/www/pw/public_html/site/templates/_init.php:20) in /var/www/pw/public_html/site/templates/_init.php on line 20 I'm not sure how to get around this? (or exactly why it's coming up) This is the case if I try to declare a 404 at the top of any template.
  23. I'm trying to modify the property 'path' for a specific Page (User, actually) using the following code: $this->addHookAfter("Page::path",$this,"modifyUserPagePath"); AND public function modifyUserPagePath(HookEvent $event){ $p = $event->object; if($p->template == "user" && $p->hasRole("ambassador")){ die("MODIFY THE PATH HERE WITH PREFIX FOR THE CURRENT VIEWING PAGE"); } } But i'm not able to retrieve the page that is currently running (as in, the page in the browser url). Please note I'm also using the render() method to render subpages content. I don't need the subpages url but only the original $page requested. Is there a pretty way to do this (besides looking it up via $_SERVER['REQUEST_URI'] )?
  24. Hello to all of you, has anybody suffered from following: I do something like that: $nr = $page; $nr->of(false); $nr->foo= $bar; $nr->foo2 = $bar2; $page->save(); $p = new Page(); $p->of(false); $p->template = 'foobar'; $p->parent = $pages->get('/bar/'); $p->title = $bar; $page->save(); then populate some more fields and again $page->save(); Everything is working fine and my created confirm save message pops up....the page is saved, but there are 3 outputs giving me $page->title after saving on the frontend. It has something to do with the save method, because when I leave them out everything is working just as designed... Hopefully somebody has advice! Regards
  25. I have a bunch of child pages added to a parent section called 'Projects'. These are all being looped out on an overview; for example: <?php $projects = $pages->find('template=project-detail, sort=sort'); ?> <?php foreach ($projects as $project) : ?> These pages will become quite long overtime, but I want to add a 'featured' option to them so they add a class to their element if they are 'featured'. Normally I would just add a tickbox so if it's ticked, it adds the class etc. However, as there are going to be so many pages, looking through them all and maintaining this (as the 'featured' option will change often) will get a bit messy. So, I've created a 'Page field' for the overview, so you can choose which pages you want as 'featured' and remove them easily. However, I'm having an issue working out how I can tell the child page that it has been 'chosen' to be featured, if you see what I mean? How can I, within the $projects loop, cross reference it with the 'featured' page field on the overview, and if they match, add a class? For example <?php $featured = $pages->get('template=home')->featured_items; ?> // Getting an array of the featured items <?php $projects = $pages->find('template=project-detail, sort=sort'); ?> <?php foreach ($projects as $project) : ?> <div class="item <?php if ( $featured->id == $project->id) : ?>featured<?php endif; ?>"></div> // Checking if the featured id contains project->id <?php endforeach; ?> I know the above isn't right, but you get the idea. Can you help at all?
×
×
  • Create New...