Recently Browsing 0 members
No registered users viewing this page.
Hello fellow Process wire Developers!
Today i have encountered an issue using the repeater where I can't find out how to solve it therefore i am asking for help.
To be specific, I am trying to get the "file" field working properly in the repeater but i couldn't find a way on how to assign a property of a field that is being used by the repeater.
download_pdf is the name of the field that i want to access properties from.
What i wished i could do was something like $download->download_pdf.size or $download->download_pdf->name, something like that but obviously these didn't work
Hope there is a solution and thanks in advance!
I've been working with different CMS's for quite a few years now but there was always one thing that bugged me, I never knew how the CMS takes a url and resolves a page ID from it. I knew it was to do with the "slug" but what i couldn't figure out is when it came to sub pages, as the slug only refers to the page itself not the parent pages in the url e.g /parent-page/sub-page.
The main two CMS's i've worked with are Wordpress and ProcessWire, ProcessWire always has the upper hand when it comes to speed, even a large PW site is tens of milliseconds faster than a fresh Wordpress install.
With the resolution of urls to pages being (probably) the most used query in a CMS i thought i'd investigate the two different approaches.
Both ProcessWire and Wordpress split the urls by forward slash to extract the slugs /about/people/ => ['about', 'people'], however ProcessWire takes a completely different approach when it comes to resolving a page ID from these slugs. ProcessWire uses this query:
SELECT pages.id,pages.parent_id,pages.templates_id FROM `pages` JOIN pages AS parent2 ON (pages.parent_id=parent2.id AND (parent2.name='about')) JOIN pages AS rootparent ON (parent2.parent_id=rootparent.id AND rootparent.id=1) WHERE pages.name='people' AND (pages.status<9999999) GROUP BY pages.id LIMIT 0,1; Resulting in a single item of the page in question including the page's template id. For urls with more parts it looks as though ProcessWire creates more JOINS to essentially walk back up the hierarchy and fully resolve the ID of the correct page.
Wordpress on the other hand takes a different approach:
SELECT ID, post_name, post_parent, post_type FROM wp_posts WHERE post_name IN ('about','people') AND post_type IN ('page','attachment'); More elegant looking however it returns a list of potential items. So requires a loop within PHP to walk the hierarchy tree and determine the correct page ID.
Both queries once cached by MySQL took 19-21ms to return, ProcessWire looks as though it uses this to it's advantage by returning the correct page ID straight from the MySQL cache and doesn't require the extra looping step afterwards.
Interesting to see the different approaches to the same problems.
By Sonia Margollé
I have a problem and I don't understand. I have a profield table with different fields and a select field.
I did like it's instructed and put "value=label".
But when I'm trying to output the select field with var_dump (to debug), it's indicated that the field is a string that contains the value.
Why is it a string ? when I try myselectfield->value or label or title I have an error saying I'm trying to get a property on a non-object ...
Just wondering if its possible to just add some basic output to my modules config page.
I was wanting to output a bulleted list of some information which I will be pulling from a third party.
Retrieving the data is fine i'm just not sure how to output it to the config page?
From what I can see in the link below, it only seems like you can append form items to the page.
I'm trying to echo a field from another page, in my footer. I have a Website Settings page (id 1006) with several fields for general site settings, like store hours (field is named store_hours). In the footer, I have this:
<?php $settingsPage = $pages->get(1006); echo $settingsPage->store_hours; ?> Shouldn't that output the contents of that field? Right now it's printing a "0" (zero) on the page.
Elsewhere in the same footer template file, I have this code and it works fine:
<?php $homepage = $pages->get(1); echo $homepage->body; ?> Does it have anything to do with the fact that the field is organized into one of these tabs, at the top of the page editor?
(disclaimer: I'm new to PW, and have inherited this site from another developer; that's why I don't know how or why some of this stuff is set up the way it is).