-
Posts
71 -
Joined
-
Last visited
Contact Methods
-
Website URL
https://www.jasongorman.uk
Profile Information
-
Gender
Male
-
Location
UK
Recent Profile Visitors
3,413 profile views
mrjasongorman's Achievements
-
Ah i see thanks for the link.
-
I have a project where by i have a range of subdomains, all seperate sites, i want to know however is it possible to use a single "wire" core folder but have the sites separate from one another. The setup of the subdomains would be identical, though they would need to be isolated (DB + content + users). So each subdomain having its own "site" folder is fine. Welcome to any ideas others have to allow this to be reasonably scalable.
-
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.
-
Ah brilliant, so kind of like transients in Wordpress. Thanks for all the help!
-
Thanks for taking a look at this. I didn't realise $input had those options. The thing is I automatically generate a list of location options based on the data provided in the unit-option's. So I need to generate the full list of locations for a select box above the listings regardless of whether a $location has been provided or not. It then renders listings of unit-options grouped by the unit they're children of, and sorted based on the unit name. The ->explode() method is cool, I didn't realise it was in the API. Thanks again!
-
This is the current code $unitOptions = $pages->find("template=unit-option"); $temp_array = array(); foreach( $unitOptions as $item ){ if( $item->get('unit_location') ): array_push($temp_array, $item->get('unit_location')); endif; } $locations = array_unique($temp_array, SORT_STRING); sort($locations); $myLocation = ( !empty($_GET['location']) ) ? $sanitizer->text($_GET['location']) : null; $unitResults = null; if( $myLocation ){ $unitResults = $pages->find("template=unit-option, unit_location=$myLocation, sort=unit_name_ref"); }else{ $unitResults = $pages->find("template=unit-option, sort=unit_name_ref"); }
-
I'll try and explain the data structure better Area > Level > Path ----------------> Unit > Study Location The -------> is a page reference. So the query is $pages->find("template=study-location, sort=unit_name_ref");
-
I have a website with a slow page load mainly due to a slow query on a listing. I think there might be a better way to query the data / arrange the data back end which is what's causing the query to be slow. So the data is like this Area -> Level -> Path, the path then links to a pool of units included within that path. The units then have study locations listed as child pages for that unit with contact information etc. I have a page where i list all the study locations, but because i'm going through every unit and then every child study location page it takes quite a while. I have over 200 units with around 5 locations as sub pages. Any way i can reorganise the data to make this listing faster to load?
-
It just seems a shame that the forum auto redirects but the main site doesn't?
-
haha, so there is, 10 months is a long time in software development, and clearly a long time for my memory
-
mrjasongorman started following Amazon AWS now powering this site
-
I tried to find a thread that spoke about this, but couldn't find one, so i thought this thread mentioning the processwire.com site itself was a good place. I've noticed that processwire.com has a wildcard SSL certificate, however it doesn't automatically redirect to HTTPS or use HSTS header to inform the browser to prefer HTTPS connections. Just wondered if there was a reason for this? To clarify this only seems to happen on the main site, not the forum. going to http://processwire.com
-
I think i may have a similar problem, i currently have two websites running on the same server but under different subdomains, i have user data that needs to persist across subdomains, i'm using PHP's $_SESSION variable to store the data on the non ProcessWire site, though when i attempt to access the variables in PW they don't show up. I've got the ini_set('session.cookie_domain', '.example.com'); and i can see the PHPSESSID cookie does show up for both subdomains. However in PW when i echo session_id() it displays the session id from the wire cookie. So i guess $_SESSION variable has been taken over by that? Is there a way to still access the original $_SESSION variables from PHPSESSID ? Any help on this would be great.
-
ProcessWire the perfect CMS for HTML Emails
mrjasongorman replied to mrjasongorman's topic in Dev Talk
Nice to hear others are using this technique too. For my case the emailing system we were required to use has an "editor" but it's terrible, with PW i can add condition switches in the CMS to arrange partials in the email to a particular order etc. So much potential. -
ProcessWire the perfect CMS for HTML Emails
mrjasongorman replied to mrjasongorman's topic in Dev Talk
Ah really? that's cool, tbh i'm not sure why i didn't think of it sooner. -
I recently had a revelation when building HTML emails, what's the difference between HTML emails, and HTML web pages? Other than the horrible table syntax, the result is the same, it's still HTML. This got me thinking why not use a CMS to help generate the HTML emails based on a template? Just like we using a CMS to help generate HTML web pages. We started by setting up ProcessWire (our usual CMS of choice) and added the relevent fields for the sections of the email. Then we took a previous email moved the content into ProcessWire and hooked up the code to pull that content back into the correct places. Repeater fields allowed us to have repeatable sections that are easy to add too, change order of or remove, giving us huge flexibility when a client changes their mind last minute. The speed of setting up and dealing with ProcessWire allowed us to go from concept to working prototype within a day. To use the emails, we just view source of the generated page, and copy and paste into the email system. Sometimes Litmus inliner is required to allow the email to work in Outlook, but we can run it through that before pasting into the email system. Future development could be integrating a css inliner into the generation step, to avoid using litmus inliner. Hope this helps show how ProcessWire can be used in a different scenario.