Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by mrjasongorman

  1. 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.
  2. 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.
  3. Ah brilliant, so kind of like transients in Wordpress. Thanks for all the help!
  4. 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!
  5. 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"); }
  6. 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");
  7. 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?
  8. It just seems a shame that the forum auto redirects but the main site doesn't?
  9. haha, so there is, 10 months is a long time in software development, and clearly a long time for my memory
  10. 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
  11. 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.
  12. 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.
  13. Ah really? that's cool, tbh i'm not sure why i didn't think of it sooner.
  14. 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.
  15. 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... http://wordpress.stackexchange.com/questions/6424/mysql-database-user-which-privileges-are-needed 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.
  16. 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.
  17. @Mike Rockett Ah ok i see, i may have not read the thread properly, my bad.
  18. www.ladosis.eduardosanmiguel.com = (amazon seattle) according to https://www.iplocation.net/ www.thatsnew.net = (amazon seattle) according to https://www.iplocation.net/ Looking at curl -I www.thatsnew.net it returns: HTTP/1.1 301 Moved Permanently Server: nginx Date: Wed, 14 Sep 2016 17:30:09 GMT Content-Type: text/html; charset=iso-8859-1 X-Frame-Options: SAMEORIGIN Location: http://www.ladosis.eduardosanmiguel.com/ Age: 0 Connection: keep-alive So it's just a redirect?
  19. I've noticed that the processwire.com website runs over SSL, but i also noticed that visiting the websites over http still works, and once using the insecure version the links are also relative pointing to non-ssl links. As a fix there could possibly add an auto redirect to the HTTPS site? This could potentially then take advantage of HTTP/2 speed.
  20. I'm just wondering if there a way of creating block like functionality similar to say Episerver / drupal blocks?? I guess i could treat the template as a view that loads in sever partials (kinda like blocks) ?? Any ideas on this would be great.
  21. Figured out i can just manually enter the path to my template file at the bottom of the file select page. It then scans the file and picks up the translatable strings.
  22. As regards to language files translating strings from within my custom templates, what's the random string (key) inside a language JSON file? and where abouts do language files live? I have an issue where by PW won't pickup all my templates that have __('text') as templates that can have translation files attached to them. It's only picking up header.php, footer.php and home.php about.php gets ignored for some reason :/
  23. Is there a way i can override the CMS in code, as to what the translation should be? i've noticed it gives an options to upload JSON files
  24. Yeah all of my template files are .php for example it's not picking up about.php which has similar __('text') strings.
  • Create New...