Hello, I’m new to Komodo, and I am trying to figure out how to correctly use the preview function.
As of right now, when I press the globe icon to preview my file, one of two things happens:
If I select preview in a Komodo Tab, the webview opens up on the bottom of the window, and I am presented with a panel that asks me if I want to save or open the file. If I click open, it gives me a list of other applications, which isn’t what I want, and if I click save, the panel goes away, but the webview remains empty, without loading the file. If I then refresh the webview it loads an empty “about:blank” page.
If I select preview in chrome, the file opens in chrome, but it opens as “file://localhost/Users/myUserName/Sites/…” which just displays the text of the php file. I need it to open as “http://localhost/~myUserName/…” to actually run the code.
Is there any way to fix this? (I’d like to be able to get it running both in Komodo and Chrome, just to save myself the hassle of opening up chrome and typing in the URL of the file every time.) I tried the “Map URI” feature to map “file://localhost/Users/myUserName/Sites/” to “http://localhost/~myUserName/” and vice-versa, but nothing changed.
When working in Projects, go into your project properties and navigate to the “Mapped URIs” pane. Once there, set up the mapping between your local files and they’re URI equivalent. You can learn more about Projects in this screencast: http://komodoide.com/screencasts/watch/87287634-projects-and-what-theyre-for/
You can also manually set the URI for a single file by right clicking in the editor and going to “Properties and Preferences”, then go to the “Browser Preview” pane and fill out your preferences.
Still no luck. I tried creating a project and mapping “file://localhost/Users/myUserName/Sites/” to “http://localhost/~myUserName/” in both the project and general settings and the preview is still opening up as “file://localhost/Users/myUserName/Sites/Test.php” instead of “http://localhost/~myUserName/Test.php” as I would like.
I got it to work by going into the file preferences and mapping the entire URL, but I don’t want to have to do that for every single file I create. Is there any way to just have it map the local file directory (just the “file://localhost/Users/myUserName/Sites/” part) to the directory that works to run the actual code (just the “http://localhost/~myUserName/” part) so that I can have any files I create in the Sites directory automatically run correctly when I preview them?
When I preview in Chrome, it displays like this: “file://localhost/Users/matthew/Sites/Sandbox/Notes/Array-Functions.php” (copy and pasted from the browser)
I’m looking for the same thing but I’m sorry to say I am unable to translate your solution into my own situation.
Here’s the situation:-
I have a locally installed and configured WAMP webserver.
When I go to localhost/index.php in my web browser I am able to a see the resolved page displayed without a problem.
When I try to preview this page in Komodo I see all the code tags but not the resolved page.
I have searched the Komodo help pages but have found no solution!
The nearest I have got to a solution was the thread above but it doesn’t make a lot of sense to me.
So please. in simple terms, How on earth do I configure the URI for this local server so that I can preview the pages correctly?
I’d need to know the paths you’re dealing with but the general idea is this. In Edit > Preferences > Mapped URIs: URI: http://localhost/path/to/file.php Maps to: File:///C:/path/to/htdocs/path/to/file.php
If that doesn’t help please provide more info on what you’ve tried so far, what the “local” path is to your file and what your URL path is to your file.
The WAMP server I mentioned is located - d:\wamp\www
Below that there is a projects folder which contains named project folders which in turn contain several php files.
So lets take one specific file, d:\wamp\www\projects\basics\index.php which has one simple phpinfo() function.
When I goto localhost/projects/basics/index.php (or just localhost/project/basics) in my browser, the phpinfo() function is actioned and all the expected php and server information is displayed.
If on the otherhand, when I attempt to preview from Komodo, it displays the file at D:/wamp/www/projects/Basics/index.php with php tags and function call .i.e.
<?php
phpinfo();
?>
I have tried your suggestion above filling in all the relevant parts to fit my mappings but the result is the same.
What am I doing wrong or have I missed?