Jump to content

please help with links


realnsleo

Recommended Posts

hello everyone .. i am pretty new to php programming and web development and i need to ask this. i have designed a few websites for my clients and i am getting better and now i have started learning php to add dynamic feel to the websites. my question is whenever i create links in my pages i do something like <a href="index.php">HOME</a>, <a href="aboutUs.php">ABOUT US</a> and so on. So i uploaded the website and whenever i view the source code the links appear exactly like that yet in other professional websites i have seen i always see something like <a href="http://www.facebook.com/home.php">HOME</a> for example.

what am i doing wrong. how can i make better links to other pages. what is the use of building links in that format. thank you.

Link to comment
Share on other sites

wait, sorry i am not understanding. okay i got a couple of more questions.

 

let's say i have purchased a domain called www.mydomain.com and there are a couple of files under this domain like index.php, aboutus.php and contactus.php, then i create a subdomain called sub.mydomain.com where i save some php files for example a script that sends mail. so in the form on the contactus.php what will i place on the action ie <form method="post" action="?">

 

another question is in my website i have some php configuration files like the database connection and other scripts that perform important functions. however when i try to require a php file into one of my php pages i get an error. why is that and how can i include or require php files easily.

 

eg require("http://mydomain.com/phpfiles/myphpfile.php");  // does not work

 

thanks for all the help.

Link to comment
Share on other sites

oh i see.. thanks .. so is it a good idea to keep php files out of the www directory? my web host directory is like this

- mydomain.com

  -.cpanel

  -.htpasswds

  -.access_logs

  -.etc

  -.public_ftp

  -.public_html

  -.tmp

  -.www

 

is it more secure to create a directory for my php files outside the www directory and call them using <?php $_SERVER["DOCUMENT_ROOT"]."/myDirectory/myfiles.php"; ?> as you mentioned?

 

 

Link to comment
Share on other sites

it really dosen't matter, it saves you a step...  I usually keep files like config.php a directory back from www just in case file associations might get screwed up, other code can/should be kept in www dir.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.