|May 7, 2013, 05:27 PM||#1|
Coda 2 + MAMP pro ... How do I preview PHP?
Hey there peeps,
So I have MAMP set up. Got a host set up in it. Server name = zonedev. Disk location is set up to where I have all my files saved on the HD. (Not in MAMPs httdocs folder, by the way, if that matters)
Now, in Coda, I set up a site. Root URL http://zonedev:8888/ Local URL http://zonedev:8888/ Local Root same path as the Disk Location in MAMP.
The site "icon" (cause it's bigger than an icon) after saving the setting for Coda does show a little preview of the index.html page. So far so good-ish.
What I want to do, though, is to be able to preview PHP docs in Coda. Without MAMP running, it would just spit out an error message where the PHPinclude should go (no file found blah blah) Now with MAMP and the site set up in Coda, when I preview a PHP file, it just shows it as text and doesn't render anything.
Also, the preview address will be something like: file:///Volumes/Macintosh%20HD/Users/blah/Documents/blah/about_us.php
but if I type in the "local address" http://zonedev:8888/about_us.php it will preview the PHP for me, and includes and all.
Questions are, am I setting up my MAMP and Coda (particularly coda) right?
If so, is there a way to get Coda to do this: when I hit preview, it will preview http://zonedev:8888/about_us.php instead of the filepath file:///Volumes/Macintosh%20HD/Users/blah/Documents/blah/about_us.php
Thank you oh so much everyone!!!
|May 8, 2013, 10:33 AM||#2|
I use Coda and MAMP Pro too and previewing PHP files is not a problem for me. I use the default ports in MAMP Pro (Apache: 80, MySQL:3306) I get a warning that those ports are already in use by Apache so in MAMP Pro I go under Tools and select "disable built in Apache". I also have my website directory within my root (localhost) folder, which I point to in MAMP Pro by going to the Hosts panel, disk location and selecting "choose...". Hope that helps.
|May 8, 2013, 11:25 AM||#3|
Thank you randiferous,
I do believe that I am using the defaults as well. At least, I never put any in.
While on the subject - a couple of my other settings:
IP / Port - blank
Dynamic DNS - blank
Local name resolution - checked
SSL - not checked
I mean, so far I can put in the address bar of the preview window the local address "http://zonedev:8888/about_us.php" instead of the auto fill in of the file path on the HD. And once I do, when I click on links in that page to other pages in the site, it keeps the http://zonedev:8888/
But, when I have the screen split with code / preview - when I make changes to the code, the preview doesn't auto update like it used to when I would preview a file using the file path file:///Volumes/Macintosh%20HD/Users/blahblahblah
Instead I have to save the doc to see each change.
Anyone know how to get the auto-refresh in this situation?
Thanks again everyone.
|May 9, 2013, 12:09 AM||#4|
I strongly recommend using a browser to preview after save.
Need to clarify "preview" vs. "live updating" first, not sure which one you meant.
The former is much like a browser would do, you save a change and refresh and see the updates. Live updating means you make a change without saving and see the update without refreshing. For the record, Coda is a bit buggy in its live updating mode, Espresso is better. But both can be problematic at times with respect to live updating because PHP is a server side scripting language so although CSS and other static elements might update instantly, a save might be necessary when dynamic uncached page generation is involved, which these days is quite the norm.
Using a browser is tedious but you'll ensure you're doing it right the whole time and remember --- Chrome and FF, etc., i.e. all modern browsers, have inspection tools built in with plenty of plugin support which allow you to adjust CSS, check for console errors, make changes to DOM, view elements and resources, etc., etc. to tweak this or that. But it's being rendered by the real browser engine, not a licensed and customized copy, so what you see is really what you will get.
My .02 - I expect others to disagree with me because my advice is more situated towards professional developers doing lots of server side processing, not just output static HTML, simple theming or CSS edits. FYI
Sr. Web Developer, owner GoldTechPro, LLC
|May 9, 2013, 12:06 PM||#5|
Hey there Jim, thanks for the reply.
No, it's good advice. And a practice I use.
I do appreciate Coda's live updating using a split window. Just to remove the couple of steps of saving, switching to browser, refresh. I know, not that time consuming, but when you have to do it over and over, it gets tedious.
I do like Espresso, but I've found myself gravitated to Coda. Thank you for mentioning though.
I suppose dealing with just having to hit command-s for a live update / refresh isn't that bad of a deal. And it seems that I do have MAMP set up right. So, I'm going to just be happy I've got what I've got.
|May 9, 2013, 03:24 PM||#6|
I agree with Jim. I always check my work by previewing in a browser and using inspection tools. One thing that I might mention, if you are seeing your site by going to http://zonedev:8888 then you're using the default MAMP ports. I always switch MAMP to port 80 when I work in Coda, if you do that, then your address is simply http://zonedev/
|May 10, 2013, 12:27 PM||#7|
I use multiple desktops.
1st one on the left hold Chrome Browser, 2nd one Coda, 3rd Safari: I can quickly switch back and forth with swipes. I know not the perfect answer but I've found it to be acceptable.
I'm not sure if this will help, as I haven't tried it, but PHP (latest versions) come with a built in server. You could set it up and possibly have coda's browser window preview PHP without the need for the web stack at all. Just thinking(typing) out loud.
TI-99/4A, tape cassette, 12" B&W Zenith
|Thread Tools||Search this Thread|
|thread||Thread Starter||Forum||Replies||Last Post|
|MAMP Pro: Apache Security/Admin Account||Reg88||Web Design and Development||11||Apr 23, 2013 11:42 AM|
|Diet Coda and Air Preview||HarryPot||Web Design and Development||0||Aug 29, 2012 01:03 PM|
|Coda And Diet Coda?||Klae||Mac Applications and Mac App Store||6||Aug 11, 2012 09:20 AM|
|MAMP Pro image problem on Mountain Lion||andymac2210||Web Design and Development||0||Jul 26, 2012 06:21 AM|
|Mamp Pro phpMyAdmin Error||firedept||Web Design and Development||0||Jun 24, 2012 11:16 PM|
All times are GMT -5. The time now is 09:01 AM.