-
Posts
2,776 -
Joined
-
Last visited
-
Days Won
40
Everything posted by Macrura
-
looks like the gallery detail pages are missing title tag, for example: https://rockpoolpainting.com.au/gallery/cooranbong/
-
i don't believe you can PHP 'include' an html file, that's what my example shows, e.g. if you include then you change it to .php, or .inc. I don't know what you mean about 'form field', to confirm your question, there is no such field.
-
the problem is that you have an array, but the items in the array are \ProcessWire\Page objects, so those can't directly map to a json encode. you probably need to cycle through the pages you want and create the array manually. Alternately you could have a look at the GraphQL module, which i think some devs are using to get json data to the frontend.
-
on the page where you want to output the form, you can just conditionally load that markup from a .php, .inc, or .html file, depending on what your needs are. for example: <?php if($page->name == 'my-special-page') { // html version $form = file_get_contents($config->paths->templates . 'forms/my-form.html'); // OR wireRender $form = wireRenderFile($config->paths->templates . 'forms/my-form.php'); echo $form; // or include($config->paths->templates . 'forms/my-form.php'); }
-
That would be great - i will probably need a few weeks to sort out some issues; the theme module works by using a new WireData within global $config to store everything, and it gets initialized manually; i am trying to decide about this, and whether it should just create it's own api variable; if using $config, then it makes it easier for submodules to intercommunicate, because there is sitting the $config and then a module can check to see if there is a property in there to use; also with the theme's headAssets method, it will be better once the minification engine can be selected, right now it is hardcoded to use ProCache, but plans are in place to make it selectable between ProCache, AIOM+, or none. Another thing i have to implement is a way to register your injectable areas; right now the module init defines those, but there probably needs to be a hook or method where you can register the areas in your theme, like wp add_action..
-
most of the functions were previously in helper files and called procedurally, there is nothing too complicated about any of the functions; i just finally figured it was time to put them all into a module so that i could have a config screen and not worry about field naming between sites, because the config screen lets the module's methods be field-agnostic (for example in the blog engine, you would tell it what field is used for date, what the posts index page is, post index template etc)... I will probably put it on GitHub once it has been tested more in some varied environments. You can find a lot of these types of functions in other modules, depending on your specific needs, or don't even use a module for it, a lot of developers just put each thing into a partial and then include or wireRenderFile them all in the main template. the events engine that i'm using is just helpers for front end, so primarily deals with date formatting, handling feeds, URL segments for things like archive or month/year based results (/calendar/year/2016/), categories and tags if those are used, media (images/audio/video), related events, and schema.. recurring events are usually handled with either a multiplier for a date field, a table, or a page table, depending on the needs of the site. The Elliott Carter events listing uses a page table for recurring events because each event recurrence can actually be in a different location (for example a tour).
-
i have a theme engine module that i use which is part of a suite of modules that together, provide a frontend, or 'markup' api. The Theme Engine handles things like the body classes and is basically a wrapper module for a collection of functions/methods helpful for optimizing front end development. It includes helpers for webfonts and facilitates the handling of the site assets, enabling each template to add dependencies (js or css files, or inline scripts/styles), as well as acting as a wrapper for ProCache whereby it allows the developer to enable/disable ProCache minification as needed. For example, superusers may disable minification and the module will output the individual assets with a url paramter appended to prevent caching. It also provides a simple 'hook' system where the developer can add containers to the main template, into which templates can 'inject' markup, similar to Wordpress do_action. The Meta Engine reads settings from a settings module where the admins can enter the primary settings for the site, such as site title, copyright year and holder, publisher, social media links, contact information and more and provides an easy API to access those settings, as well as formatting for convenience. It also allows for individual templates to add and modify items to the header and footer, such as prefetch/prerender, next/prev, schema, open graph tags, custom favicon sets, and any custom markup. other members of the suite are a Blog Engine, and Events/Calendar Engine.
-
this has been discussed in the context of a repeater field with a limit of 1 item; afaik there is no way to do what you are describing
-
Can't you just make a regular fieldset tab and put them in there, i have sometimes 2-3 content tabs, and there is no reason to make a module. also on that example posted, the solution provided is only for outputting markup, like some instructions, or like a training video etc. AFAIK you cannot add a tab to page edit and expect those fields to automagically save to the database b/c the fields need to exist in the database to save to.
-
yes, to confirm, my code is designed specifically if you are not restricting within the template settings.
-
if you only want to process requests where both segments exits, then you would want to check for both. this is a simple example: if($input->urlSegment3) throw new Wire404Exception(); if($input->urlSegment1 == 'edit') { if (strlen($input->urlSegment2)) { // process the 2nd segment here } else { throw new Wire404Exception(); } } if($input->urlSegment1 == 'new') { // process request for new if (strlen($input->urlSegment2)) { throw new Wire404Exception(); } }
-
can you provide your template code for how you are dealing with the URL segments? Usually you would check each segment, and if the segment exists, you would sanitize it for further processing, and then take actions based on the validity of the segment.
-
renderPager showing 1st results on every page# and pagination
Macrura replied to hellomoto's topic in General Support
you'd need to take out the start=0, from your pages->find in order for the pagination to work, otherwise it will always show the items starting from page 1 -
renderPager showing 1st results on every page# and pagination
Macrura replied to hellomoto's topic in General Support
do you have pagination enabled on the template? -
usually for areas like news, blog, events, the best practice is to check for the URL segments as mentioned by abdus. You can look at the blog module or blog profile to possibly see some functions for how to intercept the segment, and display the filtered posts.
-
could be anything, permissions even. Can you revert to the old version? I've done some upgrades of really old site, but so far have been lucky; the worst thing sometimes is a module that is not compatible, so you may need to disable one by one the modules and see; check the logs from FTP; reset all permissions across the whole install, recursively.
-
How to capture page containing a pagetable?
Macrura replied to bmacnaughton's topic in API & Templates
usually what i do in these cases is add a page field to the template of the pagetable page, and set that field to the page that it is being edited from. I used a save hook on the main page to look at the items in the page table and for any where that page field is not set, it assigns that field to the page being edited (so setting the page field on the pagetable item to PageA). that field is also hidden using CSS. -
Just want to chime in and say thanks for this!
-
one thing i did for a complex table was - single row data is cached (wire cache) - entire table is cached (wirecache) from the row data - the json is used to create the table itself (data tables). if a single row changes, that row's cache is refreshed and the whole table, but this was fast because all of the other rows didn't need to be re-calculated. also in my case, each row had some pretty complex rendering functions that needed to run, so this was the best solution i came up with; and wirecache worked really well! in testing datatables, for my use case, inline json was the fastest to render, when compared with table markup and ajax.
-
yeah, it's basically standard; you can enable hmac validation, not that hard, but in this case might be more effort than worth it, because these guys know if a price has been changed... https://wiki.foxycart.com/v/1.1/hmac_validation
-
you can also set the icon in the AdminThemeReno settings, if you are using that Admin theme.
-
Need to move child page and descendants to root
Macrura replied to timothy.m.wilson's topic in General Support
you can rename your homepage to blog, but then you page tree on the backend will show all the posts at the root (sub home) level. Usually this sort of thing is done using url segments in combination with a page path rewrite hook to make the blog posts live off the root. Look for the CMS critic case study to see an example of that. -
CMS Critic Powered by ProcessWire (again) + Case Study
Macrura replied to ryan's topic in News & Announcements
they did cover PW 3 https://www.cmscritic.com/processwire-3.0-alpha-1-released/ -
I'm using this function in places, seems to work well: /** * Given an email address render the obfuscated version * * @param $strEmail - an email address * */ function createMailto($strEmail) { $strNewAddress = ''; for($intCounter = 0; $intCounter < strlen($strEmail); $intCounter++){ $strNewAddress .= "&#" . ord(substr($strEmail,$intCounter,1)) . ";"; } $arrEmail = explode("@", $strNewAddress); $strTag = "<script type='text/javascript'>\n"; $strTag .= "<!--\n"; $strTag .= "document.write('<a href=\"mai');\n"; $strTag .= "document.write('lto');\n"; $strTag .= "document.write(':" . $arrEmail[0] . "');\n"; $strTag .= "document.write('@');\n"; $strTag .= "document.write('" . $arrEmail[1] . "\">');\n"; $strTag .= "document.write('" . $arrEmail[0] . "');\n"; $strTag .= "document.write('@');\n"; $strTag .= "document.write('" . $arrEmail[1] . "<\/a>');\n"; $strTag .= "// -->\n"; $strTag .= "</script><noscript>" . $arrEmail[0] . " at \n"; $strTag .= str_replace("."," dot ",$arrEmail[1]) . "</noscript>"; return $strTag; } also works well in a hanna code, and doesn't require any additional js files
-
How can I move ckeditor styles.js to another site folder?
Macrura replied to John W.'s topic in General Support
you have to follow the format: mystyles: /site/modules/etc.. you only have the path; also make sure to change the name of the styleset to add, so it doesn't conflict with the core.