Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

sweet160

macrumors regular
Original poster
Oct 2, 2006
131
3
Ecuador
Hey,

I have a problem.

Yesterday I migrated from my old iMac to a new Macbook, using Apples Migration tool.

All went well. Everthing works all the applications work.

Only I couldnt get my webpages to show in my browser using Mamp Pro.

I got a message during startup that I could'nt use two identical names for my computers on my network. So it changed the name automaticly.

On the new comp my webpages showed blank using Mamp Pro, on the old one everthing worked as normal.

But I had to fiddle with the name of the old computer. So now I have blank pages on both computers.

Its probably something simple but how do I get my browser to show http://localhost:8888/ again like it used to do?
 
You're actually accessing 127.0.0.1 for the "localhost" domain.

If I am following the problem correctly, you resolved the public domain name for each machine but you actually develop using a MAMP sandbox. If so:

Make sure Apache is set to listen to the correct IP and port, i.e.

Listen 127.0.0.1:8888

And make sure if you setup any virtual hosts in Apache they also include the port, i.e.

NameVirtualHost *:8888

<VirtualHost *:8888>
...your stuff here...
</VirtualHost>

Restart Apache (through MAMP)

That's all that's necessary for the URL you gave to work, aside from any firewall blocking you didn't mention.

Hope this helps

-jim
 
Hey thanks for the help!

I am not firewallblocking that port so thats not it.

I changed my localhost name so now my pages show blank, but my Mamp pro is working properly.

You know I am a newb so what exactly do you mean with Setting up Apache to listen to the correct IP and port? How do I do that?

When i go to my browser and enter the 127.0.0.1:8888 I get the same as localhost:8888

Thanks for helping me...

You're actually accessing 127.0.0.1 for the "localhost" domain.

If I am following the problem correctly, you resolved the public domain name for each machine but you actually develop using a MAMP sandbox. If so:

Make sure Apache is set to listen to the correct IP and port, i.e.

Listen 127.0.0.1:8888

And make sure if you setup any virtual hosts in Apache they also include the port, i.e.

NameVirtualHost *:8888

<VirtualHost *:8888>
...your stuff here...
</VirtualHost>

Restart Apache (through MAMP)

That's all that's necessary for the URL you gave to work, aside from any firewall blocking you didn't mention.

Hope this helps

-jim
 
hey sir webdesigner, I found the problem
it was just my template of my joomla page that was not loading

thanks for the help!
 
Glad you figured it out.

I responded with web server configuration since you mentioned domains and hostnames, and usually MAMP Pro does that for ya but during migrations things often go askew with the server setup. In your case MAMP Pro did fine, but if you're interesting in learning about Apache, listen directives and virtual host setup (so you can run multiple domains, some real, some fake for sandbox development) the visit http://httpd.apache.org/docs/1.3/misc/tutorials.html

If you're not into that stuff, don't worry and nevermind!

-jim
 
Actually thats very good!

Because I would like to learn how I can setup my system so I can work on different sites at the same time. Because now I am always switching my htdocs folder. Which is harder and maybe a little dangerous....

Anyway thanks again, and maybe I will have more questions about the subject...!

Jo
Glad you figured it out.

I responded with web server configuration since you mentioned domains and hostnames, and usually MAMP Pro does that for ya but during migrations things often go askew with the server setup. In your case MAMP Pro did fine, but if you're interesting in learning about Apache, listen directives and virtual host setup (so you can run multiple domains, some real, some fake for sandbox development) the visit http://httpd.apache.org/docs/1.3/misc/tutorials.html

If you're not into that stuff, don't worry and nevermind!

-jim
 
scripting

Hi Sr, webdevelpr?

Can I ask you something about scripting, I am making a form and I have a question about that.

Thanks,
Jo
 
Hi,

I made a webpage in Joomla and Installed a module where some scripting is needed. So I am in trouble :rolleyes:

http://www.mooncities.com/elhape3/component/option,com_facileforms/Itemid,115/

Here is the example of my question, on the bottom of the form if you click "vriendelijke groeten kaarten"
the text "aantal exemplaren and the input field to the left should appear.

I already can make the selectlist dissapear and appear but....

Now I would like to have the additional static html text field "aantal exemplaren" and input field (to the right)
also to hide and show with the state of that same checkbox.

Code:
function ff_ass_groeten_init(element, condition)
{ff_getElementByName('ass_groetenkl').style.visibility = "hidden";//for the box
}

{
    switch (condition) {
        case 'formentry':
            break;
        default:;
    } // switch
} // ff_ass_groeten_init

this was to make the Selectlist Hidden initially
how can I make a textfield and input field hidden as well in this code?

then

Code:
function ff_ass_groeten_action(element, action)
{   sl=ff_getElementByName('ass_groetenkl'); 
   if (element.checked)
   {
      sl.style.visibility="visible";
   }
   else
   {
      sl.style.visibility="hidden";
   }} // ff_ass_groeten_action

to show the selectlist I have this code....

How can I make the additional static text field
and input field to be shown as well in this code?

after that it would be great to have this shown selectlist and input field validated but only in case their visisbility is visible.


Does my question make any sense to you ??

Thanks for the help,
and thanks for bearing with me !
Jo


[/quote]
 
Just wrap a DIV with an ID assigned to it around all of the form elements you want to hide/display associated with that checkbox, then hide/display that entire DIV based on checkbox "checked" status.

For example (untested):

Code:
function ProcessCheckBox(divid,checked) {

  if (checked)
     document.GetElementByID(divid).style.visibility="visible";
 else 
    document.GetElementByID(divid).style.visibility="hidden";

}

HTML:

HTML:
<div id="form_block">
  <input type="checkbox" name="mycheckbox" value="1" onClick="return ProcessCheckBox("form_block",this.checked);"> Yes
  ...other input fields related to this checkbox...
</div>

In your validation script, which I assume is another function since you didn't include it above, add in a condition as follows:

Code:
if (document.GetElementByID('mycheckbox').checked) {

 ... validation code for input fields displayed when checkbox is checked ...

}

-jim
 
This looks good.

I will try it when I have some time. Hopefully tomorrow! Thanks for helping me, I will let you know how this turns out!

thanks Man!

Just wrap a DIV with an ID assigned to it around all of the form elements you want to hide/display associated with that checkbox, then hide/display that entire DIV based on checkbox "checked" status.

For example (untested):

Code:
function ProcessCheckBox(divid,checked) {

  if (checked)
     document.GetElementByID(divid).style.visibility="visible";
 else 
    document.GetElementByID(divid).style.visibility="hidden";

}

HTML:

HTML:
<div id="form_block">
  <input type="checkbox" name="mycheckbox" value="1" onClick="return ProcessCheckBox("form_block",this.checked);"> Yes
  ...other input fields related to this checkbox...
</div>

In your validation script, which I assume is another function since you didn't include it above, add in a condition as follows:

Code:
if (document.GetElementByID('mycheckbox').checked) {

 ... validation code for input fields displayed when checkbox is checked ...

}

-jim
 
I forgot to mention, maybe it's best to put the input type field for your checkbox outside the div so it doesn't disappear when checked. That way it will be visible all the time to users and reference is possible your code without having to test if the object exists. I wrote that fast!

-jim
 
Actually thats very good!

Because I would like to learn how I can setup my system so I can work on different sites at the same time. Because now I am always switching my htdocs folder. Which is harder and maybe a little dangerous....

Anyway thanks again, and maybe I will have more questions about the subject...!

Jo

Just a bit of helpful advice - you can have as many folders in your htdocs as you would like, and they can all contain different sites - your url will look like this: http://localhost:8888/website1 Just replace website1 with whatever the folder name is that you want to use. That way you can work on several different sites without changing your htdocs folder. I have about 12 sites I am working on locally right now.
 
That's a nice way of setting up multiple sandboxes, certainly easier.

The only issue with that method is that's not the true document root in the production version. I'm not referring to the simple uploading of files from ./websiteX into the web server's actual document root, I'm referring to paths being different. There might be issues with abolute paths needing to be changed due to the mismatch between the sandbox and production document root.

Here is another approach commonly used, a more complex setup of course, but also why to try it:

For sandbox setup of multiple domains edit /private/etc/hosts file and add in fake domains and exploit the localhost class C, i.e. 127.0.0.2 associated with fakedomain1.com, 127.0.0.3 for fakedomain2.com, etc., then setup Apache as discussed earlier so each domain has its own virtual host and document root path, just like in a production environment.

i.e. http://www.fakedomain1.com:8888 and http://www.fakedomain2.com:8888 will both work in your Mac's browser. The key is the different IP's, multiple domain names and unique absolute document roots that will match the production setup. No need to register domain names for sandboxes, these resolve locally.

-jim
 
Hey this looked really promising. But It give a blank page.
I Copied a complete joomla website in my htdocs folder in a website1 folder, then went to http://localhost:8888/website1 but it didnt work.

Do I have to change something to Mamp pro to make this work?
Just a bit of helpful advice - you can have as many folders in your htdocs as you would like, and they can all contain different sites - your url will look like this: http://localhost:8888/website1 Just replace website1 with whatever the folder name is that you want to use. That way you can work on several different sites without changing your htdocs folder. I have about 12 sites I am working on locally right now.
 
Hi Sr Webdeveloper,

Do you mean that you links to images ect. might get broken if you upload to a server when using this method?
The only issue with that method is that's not the true document root in the production version. I'm not referring to the simple uploading of files from ./websiteX into the web server's actual document root, I'm referring to paths being different. There might be issues with abolute paths needing to be changed due to the mismatch between the sandbox and production document root.
-jim
 
Hi Sr Webdeveloper,
Do you mean that you links to images ect. might get broken if you upload to a server when using this method?

Not the simple act of uploading, I focused on absolute paths being used in the scenario being discussed here (multiple sites in multiple folders off the document root for sandboxes).

For example ("Webhost" refers to the actual LIVE web site the public uses, one unique domain name per site):

Mac sandbox site 1 path: /usr/yourname/public_html/testsite1/
Mac sandbox site 2 path: /usr/yourname/public_html/testsite2/
Webhost path (site 1 or 2): /usr/yourname/public_html/

Here's what you'd set the the src attribute in the image tag to if using absolute paths to display an image on any of the site, for example:

Mac sandbox site 1: /testsite1/images/whatever.gif
Mac sandbox site 2: /testsite2/images/whatever.gif
Wehbost (site 1 or 2): /images/whatever.gif

Which is why its suggested to use relative paths whenever possible.

I have to mention that many included libraries, frameworks, config files, XML files, upload and download paths that exist below the document root level are often accessed using the absolute path method especially on sites with alot of scripting involved. If so, you might have to change the paths one way or another which was my stated concern. I didn't say this was a major issue affecting all sites.

-jim
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.