-
Posts
807 -
Joined
-
Last visited
-
Days Won
10
Everything posted by kixe
-
Page Add step not being skipped when Name format for children is set...
kixe replied to hellomoto's topic in API & Templates
Solution: https://processwire.com/talk/topic/8576-name-format-children/?p=108748- 4 replies
-
- templates
- name generation
-
(and 1 more)
Tagged with:
-
PageTable: automatic page name format when multiple templates allowed
kixe replied to Lars282's topic in General Support
Solution: https://processwire.com/talk/topic/8576-name-format-children/?p=108748 -
Name format for children based on any field (not just title)
kixe replied to Lars282's topic in General Support
Solution: https://processwire.com/talk/topic/8576-name-format-children/?p=108748 -
Since there are a lot of topics about the same theme, I decided to write a small module which overwrites the core function ___SetupPageName(). The module allows now to populate the page name using proprietary date() function. Works like PHP date() with follwing exceptions: Everything between the brackets is detected as format string, meaning no 2nd parameter possible. No need to use quotes around the format string. Spaces not allowed. from any page property, page field including subfields, parent property, parent field etc. Meaning everything what you get with $page->get(); including dot syntax. The function will give error and warnings in case of unproper settings, but creates the page with name 'untitled' anyway. Download here: http://modules.processwire.com/modules/process-setup-page-name/ Some Examples The following settings in parent template 'Name Format Children' will assign name immediately. date(Y) date('Y-m-d') parent.title parent.parent.title parent.id template.id assign name after page saving and/or population of depending field. Overwrites 'untitled' after all fields which are defined in parent template are populated. id (any other page property) pagefieldname, multiple pagefieldnames show a warning. pagefieldname (value not populated)show an error. date() // empty, no format assigned date(Y // missing closing bracket date(Y md) // unallowed space notexistingfieldname notexistingproperty existingfield.notexistingsubfield The function in the module ___SetupPageName() could be completely copied as is to the core class $pages. @Ryan Would be nice to see this in core. Related topics: https://processwire.com/talk/topic/8576-name-format-children/ https://processwire.com/talk/topic/8217-name-format-for-children-based-on-any-field-not-just-title/ https://processwire.com/talk/topic/11628-custom-page-name/ https://processwire.com/talk/topic/11349-page-add-step-not-being-skipped-when-name-format-for-children-is-set/ https://processwire.com/talk/topic/10701-automatic-page-name-using-processpageaddexecute-and-pagetable/ https://processwire.com/talk/topic/10208-pagetable-automatic-page-name-format-when-multiple-templates-allowed/ https://processwire.com/talk/topic/9979-name-format-for-children-for-multiple-allowed-templates-for-children/ https://processwire.com/api/modules/process-template/ Any recommandations after testing welcome. Download here: Download here: http://modules.processwire.com/modules/process-setup-page-name/ Edit: small enhancement to prevent display of warning twice. 23.12.15 multiple values possible now 24.12.15 made compatible with PW 3.x 27.12.15 Update Version 1.0.8 09.01.16 Update Version 1.1.0
- 100 replies
-
- 17
-
-
- template
- autogenerate
-
(and 2 more)
Tagged with:
-
You are right ... I will correct my edit.
-
I edited my post while you was answering. $items->add is not needed here. Have a look at the edit.
-
shorter. Your solution is correct. // will find pages with text_field*=cat OR dog OR page_field=1234 OR 4321 $items = $pages->find("(text_field*=cat|dog), (page_field=1234|4321)"); // will find pages with text_field*=cat OR page_field=1234 dog AND text_field*=dog OR page_field=4321 $items = $pages->find("(text_field*=cat), (page_field=1234)"), $items->add("(text_field*=dog), (page_field=4321)"); // similar to $pages->find("foo=(text_field*=cat), foo=(page_field=1234), bar=(text_field*=dog), bar=(page_field=4321)"); Well explained here: https://processwire.com/api/selectors/ Edit: Correction of correction ...
-
@LostKobrakai Code checked? Endless redirect? What about subpages in the tree? Better solution: http://modules.processwire.com/modules/multisite/ could not test from here: if($config->httpHost == "domaina.com" && substr($page->url,0,10) == '/bsection/') { $session->redirect('/asection/'.substr($page->url,10)); } else if($config->httpHost == "domainb.com" && substr($page->url,0,10) == '/asection/') { $session->redirect('/bsection/'.substr($page->url,10)); }
-
use the label() method: // $page->textareasField->label($name); foreach ($page->prod_texts_data as $key => $val) echo $page->prod_texts_data->label($key);
-
Handy tools log your 404s with http://modules.processwire.com/modules/process404-logger/ edit redirects (includes a hitcounter) with http://modules.processwire.com/modules/process-redirects/ or (wildcard redirects possible like wp-*) http://modules.processwire.com/modules/process-jumplinks/
-
temporarily deactivate (default) language
kixe replied to saschapi's topic in Multi-Language Support
// set new default language $default = $languages->get('german'); // redirect if (!$user->isLoggedin() && $page->localUrl($default) != $page->url) $session->redirect($page->localUrl($default));- 2 replies
-
- 4
-
-
- redirect
- default language
-
(and 1 more)
Tagged with:
-
Unfortunately this is not possible with built in permissions. Only the other way round is possible. You can add some permissions manually which are known by PW. page-publish: Publish/unpublish pages or edit already published pages. When installed, editable() returns false, when it would otherwise return true, on published pages, if user doesn't have page-publish permission in their roles. page-hide: Hide/unhide pages page-edit-created: Edit only pages user has created page-rename: Change the name of published pages they are allowed to edit user-admin-all: Administer users in any role (except superuser) Have a deeper look here: https://processwire.com/api/user-access/permissions/#optional-core-permissions
-
echo use __toString() function and will return a string like '1'. In your case use API like: $image->issue_raw_image_width // returns (string) '1' $image->issue_raw_image_width->id; // returns (int) 1 $image->issue_raw_image_width->title; // returns 'Full' $image->issue_raw_image_width->value; // returns '' // settings: 1=Full|myvalue $image->issue_raw_image_width->value; // returns 'myvalue' Have a deeper look here: https://processwire.com/api/modules/select-options-fieldtype/#separate-option-values
-
# Small Note Installing the module via Somas ModulesManager (Lightbox) will only install InputfieldChosenSelect but not InputfieldChosenSelectMultiple. Would be helpful to have a note in the description and/or the error note (if InputfieldChosenSelect is selected for a multi Page Field) that this should be done manually.
-
@Mike Thanks for jumplinks. You did a great job. I like it. I have some small remarks/ questions Why isn't it listet in PW Modules? Why doesn't it have its own support board in PW Forum. ProcessRedirect is another Module. I think its better to have one support board for each module, even if they are related. I would like to have an option to clear the 'HITS'. EDIT Just found it in the directory and even the support board: https://processwire.com/talk/topic/8697-jumplinks/ It isn't listet if I select modules by Modulauthor mikerockett mikerockett or mike-rockett (better to merge) I strongly recommend to unravel Support Board for ProcessJumplinks and ProcessRedirect. Maybe this post could be moved to Jumplinks Support Board too. (Hello Pete?)
-
Welcome to the forum. You should read some tutorials, like this one. http://processwire.com/docs/tutorials/simple-website-tutorials/ In ProcessWire nearly everything is a $page (even users, roles, permissions) If you want to assign more fields to the user template. Create the fields, you need Go to templates. Select Filters, Show system templates Select template 'user' and add any field you have in your system If you want to see the fields in the user profile, you have to add them in the settings of Module ProcessProfile.
-
The triumvirate of user, role and permission with endless configuration possibilities is one of many features that I appreciate about ProcessWire. Unfortunately, this system is not really consistent. In a pilot project, a private carsharing page I use ProcessWire exclusively with the backend. All features (calendar, parking marker, dialog) are modules (processes). It was a bit tedious to control the accessibility of certain areas in the Admin. e.g. page search, ProcessPageList SettingsTab, Show/ Hide page tree. I managed most with hooks. It would be much easier if every feature (process class) has its own permission. To obtain maximum configuration options, while keeping clarity, each process module should have an intrinsically Permission. Permissions can be grouped, for example, as parent / child permission (pages) or via wildcards page- * (implements page-edit-*, page-delete), page-edit-* (implements page-edit-access page-edit), page-edit-access etc. This would be an important step towards Application Framework.
-
The module is tagged compatible with pw 3.0. If so it is recommended to declare a namespace or use pw namespace <?php namespace ProcessWire; More Info: http://processwire.com/api/coding-style-guide/ Please find correction in following post
-
There are some nice modules out there to solve this in a better way. For example: http://modules.processwire.com/modules/process-redirects/ http://modules.processwire.com/modules/process-jumplinks/ https://processwire.com/talk/topic/9436-page-path-history-manager/ For sure there is an endless redirect if you do $session->redirect($page->url); If you want to stay with your method you can do something like the following in your landing-page template <?php // Redirect to the fake URL if real URL is accessed if (strpos($page->url,'landing-pages')) $session->redirect('/'.substr($page->url,13)); ?>
-
The secret is to create a nice selector and use the API correctly. $pages->get() returns a single page, whereas $pages->find() returns a page array. /** * has_parent=1016 selects all children and grandchildren of the page with id = 1016 * parent!=1016 excludes the children (first generation) **/ $articles = $pages->find("has_parent=1016,parent!=1016,sort=title");
-
Limit editability of page title field for specific pages
kixe replied to Neo's topic in General Support
If you have the option to assign a specific template to those pages go to template settings click on title field and manage the access of the title field only for this template. -
Your code cannot work. Your template is loaded after initialization of LazyCron. You have either to put your function in an autoload module or to initialize LazyCron again. function cronTest(HookEvent $e) { wire('log')->save("cronjobs", "Cronjobs executed."); } wire()->addHook('LazyCron::every30Seconds', null, 'cronTest'); // $modules->get('LazyCron')->init(); I have to correct myself! Lazycron adds a hook in ProcessPageView::finished which is executed after the template is loaded. Sorry for confusing. I tried your code and it works here. Beside caching missing write permission (assets/logs/) could cause the problem.
-
To force a reaction of the responsibles RewriteCond %{HTTP_HOST} !^(.*)\.yourdomain\.com$ [NC] RewriteRule (.*) <h1>Error 502 Bad Gateway</h1><p>Please contact <a href="mailto:owner@example.org">domain owner</a> and/or <a href="mailto:provider@example.org">Service Provider</a></p> [R=301,L]
-
Any PHPStorm users here who uses phpUnit? Setup question
kixe replied to FrancisChung's topic in General Support
Processwire is purest PHP. Never tried PHPstorm but if PHPStorm understands PHP this should work