• Content count

  • Joined

  • Last visited

Community Reputation

50 Excellent

About mrjasongorman

  • Rank
    Full Member

Contact Methods

  • Website URL

Profile Information

  • Gender
  • Location

Recent Profile Visitors

1,833 profile views
  1. 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.parent_id,pages.templates_id FROM `pages` JOIN pages AS parent2 ON ( AND ('about')) JOIN pages AS rootparent ON ( AND WHERE'people' AND (pages.status<9999999) GROUP BY 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.
  2. Ah brilliant, so kind of like transients in Wordpress. Thanks for all the help!
  3. 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!
  4. 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"); }
  5. 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");
  6. 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?
  7. It just seems a shame that the forum auto redirects but the main site doesn't?
  8. haha, so there is, 10 months is a long time in software development, and clearly a long time for my memory
  9. I tried to find a thread that spoke about this, but couldn't find one, so i thought this thread mentioning the site itself was a good place. I've noticed that 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
  10. 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', ''); 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.
  11. 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.
  12. Looking at the requirements i think these privileges should be enough? Data: SELECT, INSERT, UPDATE, DELETE Definition: CREATE, ALTER, DROP Extra: INDEX Similar to this requirement from Wordpress... Also points out a nice config conditional trick where by a higher privileged DB user is used in the admin area, and normal pages use lower privileges (possibly just SELECT). Hope this helps keep ProcessWire setups even more secure.
  13. I'm just wondering exactly what MySQL permissions are required for ProcessWire? From a security point of view i would prefer to lock down the MySQL user that ProcessWire uses to the least amount of privileges needed. I guess it's SELECT, INSERT, UPDATE, DELETE, but do any modules create additional indexes? Any help on this would be great.