-
Posts
2,776 -
Joined
-
Last visited
-
Days Won
40
Everything posted by Macrura
-
The latest version of Admin Help module allows you to add a field to any help doc called help_header, which is then prepended to the edit form, for the template that this is enabled for. I use this for exactly the purpose you describe here, as well as putting a lot of instructions at the top of the page edit for certain template/page types; does help a lot and cuts down on support calls.. Alternately you can achieve this with a custom hook/function in your ready.php, for example hook into ProcessPageEdit::buildForm, and then prepend some markup depending if the conditions are met
- 1 reply
-
- 3
-
-
i've been using the enhanced icon select in my selectize template and field tags module, which has served well for the past year; http://modules.processwire.com/modules/selectize-template-field-tags/ but your module looks like possible improvement..thanks!
-
Process module - user edit page under custom URL
Macrura replied to gebeer's topic in Module/Plugin Development
have you tried setting the get var programmatically in the module (e.g. $input->get->id = $this->user->id)? -
@MaryMatlow what version of PHP are you using? You do need to be on 5.4+
-
can you provide screenshots of your templates folder, and the screen showing where you entered the alternate template file name. other considerations, are you using delayed output, do you have _main.php... also pls. post the debug message, url etc..
-
500 Internal Server Error error while installing processwire
Macrura replied to Chamche's topic in Getting Started
We have 2 sites running no problem on BlueHost. Have you checked the permissions on the files? -
Micro Contexts (aka field value contexts) Change any context-enabled setting in your page editor/template based on the value of a page reference field. Why use this? Say you have a template that is controlling some generic part of your website, like a section on the homepage, a widget, or an item in a media library. If you are using the various fields on this template in different ways depending on an option (page select) such as 'widget_type', 'media_type', etc, you can hot-switch the template context based on the field's value. Why not use template, like just change the template? Unfortunately, most of my clients would probably break down in tears if i tried to explain what a template is, or how to change it. This also allows you to have better more relevant labels, descriptions and notes based on any page ref field value on your template, as well as be able to show/hide fields based on that value, or even move fields around to make some more prominent or visible. How to use this 1.) Create a new template: 1a) Use the following name structure: mc-[field_name]-[field_value]-[any_memo_here] where [field_name] is the field that will control the micro context, and the [field_value] is the required value (page id) that the controller field must equal/have in order to trigger the virtual template context. The last part of the template name should be used for the page name, or some memo to make it easier to know from the templates list what field value will trigger the micro context, since the template name does require the ID value of the field, not the name. 1b) Make sure to specify the template you are contextualizing under "Duplicate fields used by another template" before clicking save! 1c) Edit your field settings for this template, for when your fieldname=value as specified in the template name (labels, descriptions, notes, visibility, field order etc.) 2.) Place this code in your ready.php file: wire()->addHookAfter('ProcessPageEdit::loadPage', null, function (HookEvent $e) { $page = $e->return; $mcPlates = $this->wire('templates')->find("name^=mc-"); if(!count($mcPlates)) return; foreach($mcPlates as $mcPlate) { $nameParts = explode('-', $mcPlate->name); // expected format: mc-[field_name]-[page-id]-[anything-you-want-here] $mc_field = $nameParts[1]; // the field controlling the micro context $mc_value = $nameParts[2]; // page id has to be the 3rd part of the template name $controllerField = $page->fields->get($mc_field); //if we find a matching controller field from the template name... if($controllerField) { $f_value = $page->get($controllerField->name); $proceed = false; if( ($f_value instanceof PageArray) || ($f_value instanceof Page) ) $proceed = true; // this only works with page reference fields. if(!$proceed) continue; // the page corresponding to the required value (page id) specified in the mc template name, to change micro context $mc_page = wire('pages')->get((int) $mc_value); // if the value specified in the mc template name matches the current value of the page reference field, change the // fieldgroup context $proceed = false; if( $f_value instanceof PageArray && $f_value->has($mc_page) ) $proceed = true; if( $f_value instanceof Page && $f_value == $mc_page ) $proceed = true; if($proceed) { $tName = $mcPlate->name; $mc_template = wire('templates')->find("name=$tName")->first(); if($mc_template) { $mc_fieldgroup = $mc_template->fieldgroup; $page->template->fieldgroup = $mc_fieldgroup; } } } } }); Caveats This probably needs more work to be fully usable, and may need more bullet proofing in terms of checking for valid template name, etc. You can only have this work with 1 page reference field per template. This has been tested and is being used on at least 2 live sites, but caution should be used, and the functionality should be tested before using on a live site. Screenshots: 1) a default widget with no field value context enabled fields 2.) A field value context enabled edit page for the 'Widget Type', the template controlling this is now 'mc-widget_type-1054-text', but the template of the page stays as 'widget'; only the fieldgroup context is changed when the page is loaded to get the contextual settings: 3.) the context for when the page reference field called 'widget_type' has the value of 1150, which is a video widget type (template name is 'mc-widget_type-1150-video'). Convenient Module edition coming soon!
-
I will try and test on my local environment, but probably can't post back on this until Sunday or Monday
-
Have you tried a different prefix?
-
I think you need to use pagefileSecure: $config->pagefileSecure bool When used, files in /site/assets/files/ will be protected with the same access as the page. Routines files through a passthrough script.
-
I noticed that if a table is marked as 'crashed', the process module won't load, e.g. you get a "process returned no content", instead of the usual interface. We have had some server issues with Site5 hosting that has caused tables to randomly crash and only way to fix is from phpMyAdmin, but if we could use ProcessDiagnostics to repair the table(s), that would save a step..
-
I Love The SkyScraper Demo but can I installed it from cpanel?
Macrura replied to Dee's topic in Getting Started
I would recommend learning how to install it manually. AFAIK profiles are installed when you install the system itself, because a profile is a complete, self-dependent collection of data, templates, modules, functions and a front end that all work together. In terms of the cPanel automated backups, perhaps you can still have automated backups, even if you don't install PW using the cPanel installer. In terms of upgrades, i wouldn't recommend any sort of automated upgrades, because with any upgrade you always risk something not working, so you'll want to use a stable version and then don't upgrade it unless absolutely necessary. ProcessWire is not like other CMS that have constant updates and security fixes. Sites run fine for many years on a stable version, and only need upgrading when you requires some feature of a newer version. In the case of upgrading, the process is such that you can fairly easily roll back any upgrade you make (to modules and core). For example if you upgrade a module using the updates module, then the old one gets renamed with a prefix dot. If something goes wrong with because of that particular module upgrade, then you can switch out the old one, but you need to do it using FTP. In terms of playing with the Skyscrapers Demo, it is certainly worth checking out, both the structure in the admin, but more importantly the template files where all of the PHP code is to make the magic happen. -
I'm not totally sure if Sharrre still works – it hasn't been updated since 2012 and I think it stopped working on some of my sites so I replaced the sharing buttons and used the MarkupSocialShare; I would double check that everything works and you are able to get the values from Facebook...
-
ckeditor extra allowed content not work properly
Macrura replied to adrianmak's topic in General Support
or if you need to have inline icons (within the editor), you could use a hanna code to convert the hanna tag into an icon. -
Module Visual Page Selector (commercial page picker module for ProcessWire)
Macrura replied to kongondo's topic in Modules/Plugins
ok thanks, i will send a message.... -
I thought we already had seeds... http://cheatsheet.processwire.com/pagearray-wirearray/getting-items/findrandomtimed-n/ http://processwire.com/api/ref/wire-array/find-random-timed/ though not sure if this will work for your use scenario...
-
It could be possibly tricky to have the reset admin password on the admin template, since you cannot predict who will access that... The tip is useful though, and would be probably too complicated for the scope of that article to explain about putting it into some more obscure template (like a console or tools/api); $users->get('admin'); maybe needs to be $users->get('name-of-superuser'); // change this to the actual 'name' of the user
-
About Standard Theme Processwire: where is html file?
Macrura replied to franciccio-ITALIANO's topic in General Support
you would be writing php code to communicate with the PW api, to get your dynamic content from the CMS. In reference to the $config->urls->templates, you can take a look at the default _main.php to see how that is being used to reference the themes folder, when you reference an asset (css or js file) that is stored within your templates folder. -
I would just do a normal page for news ; your sidebar and main content would be separate things, and then your news template shows the $page->body, this way the news pages are indexable, and bookmarkable. the links need to links to the ->url parameter,so if you are foreaching the news items on the sidebar as $item, then the href is $item->url;
-
About Standard Theme Processwire: where is html file?
Macrura replied to franciccio-ITALIANO's topic in General Support
I would just say, it's no small thing – adapting a CSS theme to be used in processwire requires a decent knowledge of how to use the API, as well as some fairly good experience with HTML and PHP. I can get a basic HTML 'theme' into a simple PW site in around 3-5 hrs, depending on the complexity, and that is using a lot of helper modules and functions that I developed over the years. It depends on the content of the site, how many templates you have and the types of fields you are using. For a 1 page site, it should be pretty simple, you just need to replace the contents of the _main.php file with the content of the html file and then update all of the paths to the assets, using for example a call to the $config variable for the templates folder (e.g. $config->urls->templates . "styles/my-style.css";) -
you should be able to paginate any PageArray https://processwire.com/api/modules/markup-pager-nav/
-
comments: 1) You might want to consider using pages instead of repeater for news items (repeaters are not really meant for infinitely scaling content types) 2) Sounds like you want to use ajax to change the content of the news article that was clicked on, on the left side? - maybe take a look at this: http://barbajs.org/
-
About Standard Theme Processwire: where is html file?
Macrura replied to franciccio-ITALIANO's topic in General Support
They are not, the templates are PHP files. You need to look in /site/templates/ Yes But if you use the wireRender pattern, then you can create pure html views, still .php files, but those can be placed into a $content variable for delayed output. -
it would be cool if the classes were a field in the module config, so you could add or change them
-
Module Visual Page Selector (commercial page picker module for ProcessWire)
Macrura replied to kongondo's topic in Modules/Plugins
Hi Kongondo, i'm looking for a popup page selector, that would show the pages in a lister – but in my case sometimes no image is needed, only the list - is that something that VPS can do, or could it be something made configurable for the module; Out of all of the various page pickers, one that i seem to be in need of is a lister style popup, which could be very useful where you have to select a page, but need to see some columns to know what you are picking, and the ability to sort, and filter the selectable pages...