Jump to content

muzzer

Members
  • Content Count

    116
  • Joined

  • Last visited

Everything posted by muzzer

  1. Hey, I have a multi domain setup on Processwire 2.7. It's NOT using the multisite module or anything like that. So how it goes is I have a VPS with the main processwire system and website setup on it. Then I have virtual hosts with thier "secondary domains" which symlink to the PW /site and /wire folders but have their own .htaccess. In the .htaccess of each secondary domain I redirect to a specific folder in processwire directly off the / (home) folder So domain1 (lets call ir domain1.com) is the main domain with processwire setup on it. Domain2 (which we'll call domain2.com) has the symlinked /site and /wire folders (targeting domain1 /site and /wire files/folders). Domain2 also has it's own (not symlinked) .htaccess pointing any domain2 requests to /domain2 page and children on the PW system. Hope that makes sense. I've been using this for years and it works brilliantly and is simple to add domains to, all which use the same PW system and database. So the PW page tree looks something like /home (ie domain1.com) /domain2 (ie domain2.com) /childpage1 (ie domain2.com/childpage1) /childpage2 (ie domain2.com/childpage2) /childpage1 (ie domain1.com/childpage) /admin (ie domain1.com/admin) ...etc Now however I wish to access /admin from domain2 - domain2.com/admin/ But it seems I can't do this because any domain2 requests correspond to the page /domain2 and it's child pages and the admin page is above this in the pages tree, so invisible to domain2 Does anyone know if there Is there any way I can access /admin from domain2.com? Ideas?
  2. Hey @abdus, Thank you! I was not aware you could do anything like this! Love it. BTW the ugly styling in my screenshot was just the default from the snipping app, I never meant you to copy it so accurately! Bonus points for that. @tpr thanks for the AdminOnSteriods suggestion, it looks interesting, will check it out. Cool name too.
  3. Similar (related) question. I have templates with up to 50 fields. I don't work in the Admin much but do use it to lookup values on pages and with my poor memory, and even with pretty good naming convention for my fields (some are similar) I often lose track of field names. Is there any way (short of manually appending the field name to the label) to show both label and field name above the field input. Essentially, is there somewhere an option to automatically append the field name to the field label. Please see screenshot for basic idea: Thx
  4. I have what is building to be what I would consider a large site and am starting to notice a few pages running slower than I would like. I've been looking at various options for speeding them up and it seems the database interactions are probably the part which drag the most. So now I'm trying to understand how PW handles queries and pages objects so I can program more efficiently, so my question is: $bookings = $pages->get('/bookings/')->find('room=roomOne'); foreach($bookings as $booking) $roomData = $booking->find('date=' . $today); In the above snippet is the third line performing the find() on the $bookings pages object in memory or is it querying the database again and using the $bookings ojects to refine the query? I'm trying to reduce the database queries (especially repeat queries) so understanding this would be helpful.
  5. I just had a duh! moment and thought I should share as it may be useful to others, especially PW beginners. I know a lot of you will go "yeah well duh...." and yeah, well I feel like a bit of an idiot but anyways.... I had a page outputting a table detailing data from about 200 records (PW pages). For each record it searched for child pages of a certain template, probably averaging 3 child pages per record and added some data from those pages to each row of the table. Simple stuff. The page was averaging about 12 seconds to load. Anyway, today I got frustrated enough to try to work out why it was so slow. Turns out I realised that the child pages I was searching for were all direct children, so I changed my search method from $pages->get(....)->find(.....) to $pages->get(.....)->children(.....) and blow me down the page load has gone from 12 seconds to a tad over 1 second. Turns out each child page had many child pages of their own (thousand of pages in total) and all these were being searched with the find() method. Stupid mistake, but I think right from the beginning of my learning of PW the find() method was ingrained. So hopefully this helps some newbies and others like me. Check out http://cheatsheet.processwire.com/page/built-in-methods-reference/page-find-selector/ and http://cheatsheet.processwire.com/page/built-in-methods-reference/page-children-selector/ for more info on these methods and others.
  6. kia ora Robin, Yeah, that looks like an ideal start. And I will likely start learning about PW modules in the process. Sweet as, cheers mate.
  7. Hey thx Adrian, agree with you. I do use Lister Pro which is awesome, but I also use the page tree a lot when flicking between pages, hence the question....
  8. I can't find the following but I'm sure I'm not the only one who would use such functionality so it must have been thought of and perhaps implemented in a module; I find when I'm using the page tree in the PW admin that I'm often opening (editing) many pages just to check the field values - one of my sites has a lot of user input so fields change regularly without my necessarily knowing. This can get annoying as I either lose the page tree when clicking the edit link, or I need to open in a new tab, both of which are slow processes when checking multiple pages, and I end up with loads of open editing tabs. I'm wondering if anyone has created a module to simply show basic page field info in an ajax tooltip when hovering pages in the page tree? If not, is this something a intermediate programmer such as myself could feasibly develop into the PW system or is this realistically a project for gurus only?
  9. Have to agree Pierre-Luc, mandrill is pretty sharp. I've been using it for about four weeks with this module and it's been 100% reliable (which I can't say for my previous SMTP setup. The API is sweet and the dashboard is pretty bloody good to boot. This is one system I'll use again and again. Cheers Craig for getting me onto this.
  10. I trialled a subdomain to get concurrent requests. It worked, but the domain lookup time for the subdomain killed and benefit I got from concurrent requests. How does one get around this, how can I set the domain caching to say two weeks to minimise domain lookup delay? Or am I on the wrong track?
  11. Hey @horst, seems this is indeed the issue, I presume singular:true only allows or reuses a single instance of the class. Thx
  12. Yeah thx @tpr, that's what I was originally doing. However I was extending wireMail with added the module WireMailMandrill to send via Mandrills API, but this in conjunction with new wireMail(), causes the WireMailMandrill function tags() to throw an error: tags does not exist or is not callable in this context $mailTwo = wireMail(); $mailTwo ->to('recip@two.com', 'recip two') ->from('some@address.com', 'Sender Two') ->subject('Subject two') ->tags('my tag') ->send();
  13. If I wish to make two wireMail calls one after the other - how do I reset the member vars set in the first call? $mailOne = wireMail(); $mailOne ->to('recip@one.com', 'recip one') ->from('some@address.com', 'Sender One') ->subject('Subject one') ->bodyHTML($htmlMsg) ->send(); $mailTwo = wireMail(); $mailTwo ->to('recip@two.com', 'recip two') ->from('some@address.com', 'Sender Two') ->subject('Subject two') ->send(); $mailTwo appears to have both recipients recip@one.com and recip@two.com, and also has $bodyHtml content set from the first wireMail instance. I'd like all $mailTwo member vars to be unset to being with. I would have thought this was default behaviour, where am I going wrong? Are $mailOne and $mailTwo not complete separate instances of wireMail?
  14. Thx for this Alan, been checking out Mandrill since reading your post earlier, and running some test emails etc. Looks like a pretty sweet system. Will check out the API over the weekend as that looks pretty sharp also I think I'll be moving all my site emails to Mandrill. Cheers.
  15. In summary, i think that maybe there should be an emergency shut off in AIOM+, because without the method described above, how would you keep a site online say if AIOM+ was just totally failing? Yes, I have also experienced a few weeks back exactly the same as you describe here, and resolved it essentially the same way. As with you I had unwanted downtime while I sorted the issue. As a result I've also implemented a system similar to yours, which makes me think others are probably doing the same also. If this is something that is being repeated on multiple sites then ideally it should become part of the AIOM module.
  16. Looks really nice, good stuff Tom, I'm gonna install this and give it a burn when I get a minute. I realise you mention it's not version control, but if all changes are recorded (even text areas) as they appear to be then I'm guessing it's possible to add a roll-back feature to crank a field back to a previous version?
  17. muzzer

    PW and git?

    OK FWIW I've kind of achieved what I was after by creating a repo solely for pulling images (/site/assets/files) from remote server to dev box and another repo for the site/templates folder to upload all dev changes I make to the remote server. Works well enough. For the images I'm talking about almost 2000 image folders with a 10-20 images per folder so doing this sync with WinSCP every few days was a drawn out process, now it's a couple of git commands and magic happens I might cron it as the icing on the cake. I'm starting to love git! I'd still like to have the entire site as a repo for backup purposes (to bitbucket) but my understanding of git is still a little limited. I suspect I need to read up on "git submodule" to handle repos within repos. Any hints here would be appreciated. Als, I'd be interested to know how many PW users use version control to manage website deployments. is it really as common as the blogs I'm reading make it seem? Cos to be honest, getting to know git has not been cheap on my time!
  18. muzzer

    PW and git?

    As a solo developer I'm finally taking the plunge into git, seems like everyone is obsessed with version controlling etc so I figure I'm a bit behind the times still manually transferring files. So I've set up git on my dev box and also on the remote server, and have bitbucket in there also. My ideal workflow is really pretty simple; Make changes and test on dev box, commit changes and push to bitbucket, and a bitbucket post hook then pushes the changes received on bitbucket to the remote server (live website) and does an automatic git update. So a simple git commit/push automatically updates my live site. Much easier than manually transferring file I grant you that. Ok, now I have the entire PW site as the master branch. I realise I could just version control the site/templates folder but I want the entire site on bitbucket so that it acts as a backup as much as anything else. Also, as the website has a load of users altering images I want to be able to push the site/assets/files folder on the remote server bitbucket and then pull it onto my dev box every now and then, but never push it from dev to remote. There is also the issue of files such as .htaccess which should be ignored. So summarizing, I need to implement: never push .htaccess or site/assets/files from dev to bitbucket, but allow push of /site/assets/files from remote to bitbucket (for pull into dev) Does .gitignore handle this scenario and can I set different gitignores for dev and remote pushes? Or is there a better way? Should I be using a separate branch of the entire PW site to version control just the site folder and keep the main branch as my "site backup"? Please excuse if this is a basic question, I'm sure regular git users will think so, but I have to say, implementing git to this stage has been a bit of a mindf*** for me. But I'm getting my head around it now. Seems like there is a thousand ways to skin this particular cat and working out the best method for my particular workflow is, well.....
  19. Using repeaters for the first time and wanted some clarification; In the repeater documentation it provides sample code for adding a new repeater via the api: $building = $page->buildings->getNew(); $building->title = 'One Atlantic Center'; $building->feet_high = 880; $building->num_floors = 50; $building->year_built = 1997; $building->save(); $page->buildings->add($building); $page->save(); Okay, I've followed this with my code as follows: $pg = wire('pages')->get(86040); $newroom = $pg->sRoomsRepeater->getNew(); $newroom->title = 'new room'; $newroom->sRoomType = 85952; $newroom->sPriceBand = 85984; $newroom->sPrice = '300.00'; $newroom->save(); and a new repeater is added to the page. Sweet. I go into the PW admin and confirm it is indeed added to the page. Ryan states: So calling getNew() followed by save() creates and saves the new repeater item. What I don't understand is the final two lines of Ryans sample where he uses the add method - what is this for? In my code the new repeater field is already added and saved into the page without using this method. What am I missing?
  20. @bbeer, I know the feeling, damn you Revo! All the way to hell! But looking on the bright side, while modx was nice to develop on, it feels like my current choice of CMS is simply a classier and more hardened unit ;-) So I'm kinda glad Revo came along and killed Evo. PW will take a bit more killing thou...
  21. OK, so there is not a "console" or the like for executing API calls, just thought perhaps there was a module or something which covered this, seems to be for nearly everything else Several solutions, all better than I'm currently doing, thanks guys. @Macrura, I think I'll set this up as you describe and see how it goes. If it's got the Soma seal of approval.... say no more.
  22. Is there any way (module?) to execute basic api commands from inside the PW admin? For example, say I wanted to do a (one-off) something like set a field value to "this is a default value" for all pages with a specified template; What I do presently is temporarily add some code to a template file and then browse to a page which uses that template; Then once the commands are run I delete the code from the template..... $p = $pages->get("template=test"); $p->of(false); $p->set( 'fieldx', 'this is a default value' ); $p->save(); The PW API is so good, so coupling it with such a cumbersome method to achieve a simple pages update seems dodgy. Am I missing something? I find myself doing this type of thing quite often, so how does a real PW geek (as opposed to a wannabe PW geek ;-)) achieve the above?
  23. Holy hell that's a bloody brilliant answer, ESRCH you are the man! I've done this with a pageTable as you described and the result is perfect. But even better is the explanation of the difference between pro table and pageTable, and the way the data is stored. This explanation also gives me a better insight into why Ryan chose to have each field in PW as it's own table rather than have all fields for a page stored in one row in a pages table (like modx used to I think). This is something that always bothered me a little. response #5 should be pinned.
  24. Thx for the detailed replies. Just to clarify as there appears to be some confusion on what I'm trying to achieve; The questions will be set on the template - ie, they do not change. The user answers them all. So inputfield dependencies are not needed (but thx for the idea, never used dependencies so will have to look at this cool feature). The table field option is not one I had considered or ever used before. Tried it out and it seems to cover all the bases very nicely, so this is probably the way to go. What is the difference between a table field and the profields table? Ryan mentioned in a post I have since lost that the profields are more efficient, can anyone elaborate on this? Is the upgrade to pro worthwhile - how often are developers utilizing the other fields available in profields?
×
×
  • Create New...