1 2 Previous Next 59 Replies Latest reply on Mar 15, 2012 12:54 PM by Jeffrey54 Lane Go to original post
      • 40. Re: Server side includes
        osgood_ Level 8

        You don't need different 'back to the top of the page' links on everypage.

         

         

        Just use the same 'named anchor' on every page:

         

        <a name="pageTop" id="pageTop"></a>

         

        and the same link on every page: (obviously this would go in your includes file)

         

        <a href="#pageTop">Top of page</a>

        • 41. Re: Server side includes
          Jeffrey54 Lane Level 1

          Thank you I will try that tomorrow Thanks Jeff

          • 42. Re: Server side includes
            Jeffrey54 Lane Level 1

            Hi Osgood It’s me again, I take it this at the top of each page, and not the include if that’s right, can I put it anywhere in the top or is there a particular place.

             

            And this one Top of page is the link and go’s in the include file, that is where the links are.

             

            I’ve got all the includes working new it’s just this one that’s a bit of a pain. Thanks Jeff

            • 43. Re: Server side includes
              polar_bare Level 4

              On the page where you want the anchor, set your cursor there.

               

              Then go to Insert/Names anchor and call it top

               

              Then place a link on the bottom or where it goes and place this there: <a href="#top">top</a>

               

              Jim

              • 44. Re: Server side includes
                Nancy OShea Adobe Community Professional & MVP

                You don't even need a named anchor.

                 

                Put a div id at the top or just above the content portion on all your pages.

                <div id="top">This is top</div>

                 

                Open your include file and add this link:

                <a href="#top">Link to top</a>

                 

                 

                Nancy O.

                Alt-Web Design & Publishing

                Web | Graphics | Print | Media  Specialists 

                http://alt-web.com/

                http://twitter.com/altweb

                http://alt-web.blogspot.com/

                • 45. Re: Server side includes
                  Jeffrey54 Lane Level 1

                  Hi Osgood mentioned using an htaccess page (below) what is an htaccess page and do I go about setting one up.

                   

                  Thanks Jeff

                  • 46. Re: Server side includes
                    osgood_ Level 8

                    You can just set one up using any text editing software.

                     

                    In your case its use would be to primary to 'redirect' any Google listed pages to the new correct ones.

                     

                    For instance say one of your original internal .html pages is highly ranked/listed in Google. If the end-user clicks the link the page has gone, pretty annoying for the end-user and not so good for your site rankings/listing either.

                     

                    In the htaccess file just list the page redirect 301- line by line. In the example below two pages from a site have changed from about_us.html and plans.html to about_us.php and plans.php. You list where they were in the site folder followed by the new location using the full URL link

                     

                     

                    redirect 301 /mainpages/about_us.html http://www.yourDomain.co.uk/mainpages/about_us.php

                     

                    redirect 301 /mainpages/plans.html http://www.yourDomain.co.uk/mainpages/plans.php

                     

                     

                    Then upload the htaccess file into the root of the remote server. By the way the fie needs to be saved as .htaccess NOTE THE PERIOD BEFORE THE 'h'.

                     

                    I do this after I've uploaded to the server because MACS can't see files with a period infront of them.

                    • 47. Re: Server side includes
                      polar_bare Level 4

                      Os-Why can't he use his htacsess to tell it to process html as php. Then no redirect would be needed.

                       

                      How to process .html files as PHP.

                       

                      Often the question is being asked because they want to start using php to include parts of their template instead of creating static .html files. Well here is a little piece of code that has saved me countless hours, especially when moving a static .html files site to a dynamic PHP site.

                      To setup a Apache web server to process .html (.htm) files as PHP. create an .htaccess file in the root folder of your website and add these lines to the .htaccess file:

                      AddType application/x-httpd-php .htm
                      AddType application/x-httpd-php .html

                      As long as your server has been told to process .htaccess files this will tell the Apache web server to process all .htm and .html files now as php files. This now allows you to include other php files, use variables and all kinds of PHP programming on your old static .html files.

                       

                      from: http://www.lgr.ca/blog/2007/02/process-html-as-php.html

                       

                      Jim

                       

                      PS: You can also do this on an IIS installation, but the process is different.

                      • 48. Re: Server side includes
                        osgood_ Level 8

                        polar_bare wrote:

                         

                        Os-Why can't he use his htacsess to tell it to process html as php. Then no redirect would be needed.

                         

                         

                        I guess he can if it works.....I dunno.......I only use what I know and has proven to work for me in the past. Many ways to skin a cat

                         

                        Test it out.  If theres an original .html site page listed in Google then add the lines your post suggests to the htaccess file, save it, upload it and see what happens when you click the Google link. If you get taken to the newly created .php page then youre good to go.

                        • 49. Re: Server side includes
                          polar_bare Level 4

                          I tried it and it worked when I put those two lines first in my .htaccess.

                           

                          I had them at the bottom, and it didn't work.

                           

                          Jim

                          • 50. Re: Server side includes
                            osgood_ Level 8

                            polar_bare wrote:

                             

                            I tried it and it worked when I put those two lines first in my .htaccess.

                             

                            I had them at the bottom, and it didn't work.

                             

                            Jim

                             

                            We are all learing something new every hour............and forgetting something else new every minute.......used to be every day

                            • 51. Re: Server side includes
                              Jeffrey54 Lane Level 1

                              Hi I’m going to have to come back to this one, I have another prob now to do this the includes, as I said earlier all’s well, well that is the case with the first leave links on the Nav bar, but when I added the include to a page one folder away it don’t work it brings in the file the page looks good, but the links don’t work. I have tried:  ../ and ../../   And I have tried it by putting another include folder with the nav file in it, at that level, but nothing seems to work. Sorry about this Jeff

                              • 52. Re: Server side includes
                                osgood_ Level 8

                                Jeffrey54 Lane wrote:

                                 

                                Hi I’m going to have to come back to this one, I have another prob now to do this the includes, as I said earlier all’s well, well that is the case with the first leave links on the Nav bar, but when I added the include to a page one folder away it don’t work it brings in the file the page looks good, but the links don’t work. I have tried:  ../ and ../../   And I have tried it by putting another include folder with the nav file in it, at that level, but nothing seems to work. Sorry about this Jeff

                                 

                                Hence why I said working with includes is NOT as easy as is made out.

                                 

                                And why I said I always use absolute paths to any links/elements inside the include files themsleves. Why?

                                 

                                Lets look at the situation.

                                 

                                In the include file that works you say have a links like:

                                 

                                <a href="about_us.php">About Us</a> and a link to an image - <img src="images/myImage.jpg" width="100" height="100" alt="" />

                                 

                                So this ONLY works so long as the page is located directly in the site root NOT when a page which includes the include is in a folder inside the site root.

                                 

                                The links would need to be:

                                 

                                a href="../about_us.php">About Us</a> and a link to and image - <img src="../images/myImage.jpg" width="100" height="100" alt="" />

                                 

                                But that is no good because if you changed the internal include links then they won't work if the include is included in a file outside the folder.........grrrrrr!

                                 

                                So I use abosolute paths:

                                 

                                If I'm testing on my local server the path would be:

                                 

                                <a href="http://localhost/nameOfMySiteFolder/nameOfPageFolder/about_us.php">About Us</a> and a link to an image - <img src="http://localhost/nameOfMySite/images/myImage.jpg" width="100" height="100" alt="" />

                                 

                                 

                                If I'm testing/or uploading to my remote server the path would be:

                                 

                                <a  href="http://www.myDomain.co.uk/nameOfPageFolder/about_us.php">About Us</a> and a link to an image - <img src="http://www.myDomain.co.uk/images/myImage.jpg" width="100" height="100" alt="" />

                                 

                                using absolute pages to files or image/elements you can include your include files in any page in any folder of your site WITHOUT the path breaking.

                                • 53. Re: Server side includes
                                  polar_bare Level 4

                                  I don't want to throw confusion into an already confusing situation, but here goes and this is how I have handled using includes deeper into the directory structure on on external hosting using php and Apache webserver.

                                   

                                  You have to use a different syntax for using deeper into the directory structure of your website. So basically, you are telling the browswer to start at the server root, which is specified in the SSI. Here is an example of how I did this.Osgood example will work, if your hosting company allows it and is probably the easiest way to do so, but if they don't allow absolute paths, then you can try my example. The following example is how I acheived this, but you will have to make adjustments to the file folder names and include file names to suit your useage.

                                   

                                  <?php include ($_SERVER['DOCUMENT_ROOT']."/includes/yourincludefile.php"); ?>

                                   

                                  The only thing you should have to change is the folder name (includes, in the above example) and the include file name (yourincludefile.php, in the example above) and this should work no matter how deep in the directory stucture you use it, it will be the same.

                                   

                                  If Os's example work, use it, it is a simpler, more effective way.

                                   

                                  Jim

                                  • 54. Re: Server side includes
                                    osgood_ Level 8

                                    polar_bare wrote:

                                     

                                    I don't want to throw confusion into an already confusing situation, but here goes and this is how I have handled using includes deeper into the directory structure on on external hosting using php and Apache webserver.

                                     

                                    You have to use a different syntax for using deeper into the directory structure of your website. So basically, you are telling the browswer to start at the server root, which is specified in the SSI. Here is an example of how I did this.Osgood example will work, if your hosting company allows it and is probably the easiest way to do so, but if they don't allow absolute paths, then you can try my example.

                                     

                                    <?php include ($_SERVER['DOCUMENT_ROOT']."/includes/yourincludefile.php"); ?>

                                     

                                    The only thing you should have to change is the folder name (includes, in the above example) and the include file name (yourincludefile.php, in the example above) and this should work no matter how deep in the directory stucture you use it, it will be the same.

                                     

                                    If Os's example work, use it, it is a simpler, more effective way.

                                     

                                    Jim

                                     

                                    If they don't allow the use of absolute paths then move away. How do you think a lot of Wordpress sites work, Yup absolute paths.

                                    I've never come across a hosting company that doesn't allow absolute paths but the from the angle yure coming you obviously have? I think it would be very rare.

                                    • 55. Re: Server side includes
                                      Jeffrey54 Lane Level 1

                                      Hi I’ve just spoke to the hosting provider, and they don’t do absolute paths the highest they go is: /home/username/website

                                       

                                      This doesn’t mean much to me. Help. Jeff

                                      • 56. Re: Server side includes
                                        polar_bare Level 4

                                        Do a test page with an absolute path to your SSI. They might be misunderstanding what  you say. If they don't work, try it like I stated above, it worked for me, but that doesn't mean it will work for  you.

                                         

                                        One ceavet with that is: Anything in your SSI will have to be from the document root also. So if you have an image placed in the SSI, then you will have to specify it from the root using Site relative from the root as discussed earlier in this thread.

                                         

                                        Os-There is not consistant behaviors between hosting companies as you probably know. You have to work within their confines and I agree with your above statement:

                                        We are all learing something new every hour............and forgetting something else new every minute.......used to be every day. I am about at a point where I am going to hang it all up (3 years) and do something different

                                        • 57. Re: Server side includes
                                          Jeffrey54 Lane Level 1

                                          Hi It forgive but I’m getting a little lost at the moment I’ve tried this one <?php include ($_SERVER['DOCUMENT_ROOT']."/includes/yourincludefile.php"); ?> no luck I’m trying this one About Us and a link to and image - but not sure what info I should add to it.

                                           

                                          Thanks Jeff

                                          • 58. Re: Server side includes
                                            osgood_ Level 8

                                            Test if your host provides aboslute paths. They must do - you might want to host remote images and send out html emails which HAVE to use absolute paths.

                                             

                                            Just open up a new Dreameaver document and create a link to an image already hosted on your server.

                                             

                                            <img src="http://www.yourDomainname.co.uk/yourImage.jpg" width="200" height="200" />

                                             

                                            Save file and just view it locally in a browser.

                                            • 59. Re: Server side includes
                                              Jeffrey54 Lane Level 1

                                              Hi  I seem to have got the links going now, what I have done is, I created a different nav file called it main_nav_two.php for the deeper folder, it works in DW  Whether it will work on the server is yet to be seen,( I wish I could get my test site working?) Any way the prob I have now is that the links will only go to the html files, Example it will only go here: index.html and not here index.php, even though the links are pointing to them, I tried changing the html names a bit, but then they just went to an error page, and this happens where ever I am on the site. I know this is going on a bit but I believe I am getting there. Thanks Jeff

                                              1 2 Previous Next