Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New to the CF scene
    Join Date
    Aug 2007
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    What's better? Using AJAX to include external file or PHP? or other?

    Hey I just wanted to know if anyone knew the best way to include an external file. using css(can you?), php, ajax or another language? What would be best, and why?

    Which would be the fastest?

  • #2
    New to the CF scene
    Join Date
    Aug 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Of the three items you mentioned, only one is a language. CSS is a format for specifying formatting information for clients (e.g. Web browsers) to interpret. AJAX is a technique for loading XML data in web pages using Javascript (so the entire page does not need to be reloaded).

    Can you be more specific? What do you want to include in what, for what? Most likely, PHP will do what you want. If you want to load a common HTML header on many pages, you could use:

    PHP Code:
    require 'header.html'

  • #3
    New to the CF scene
    Join Date
    Aug 2007
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by SteveBach View Post
    Of the three items you mentioned, only one is a language. CSS is a format for specifying formatting information for clients (e.g. Web browsers) to interpret. AJAX is a technique for loading XML data in web pages using Javascript (so the entire page does not need to be reloaded).

    Can you be more specific? What do you want to include in what, for what? Most likely, PHP will do what you want. If you want to load a common HTML header on many pages, you could use:

    PHP Code:
    require 'header.html'
    ya, basically I want to have a mobile verson, and a computer version of the website.

    Having one folder named 'computer' one named 'articles' and then one named 'mobile'. The reason for this is because the computer version of th website has graphics, using display:none still loads the images, just doesn't show them, I want the mobile version to be really quick. The only way to do this from what I know is to do what I just explained, have the mobile version in one folder, the articles in another, and the computer in another. Then the mobile and computer versions would both individually pull the articles for each page from the articles folder.

    also, do you know a way of doing this to where I wont have to make the article file, then make an html page for the computer page, and then make another seperate page for the mobile version? because both the mobile and computer versions pull articles from the articles section.

  • #4
    New to the CF scene
    Join Date
    Aug 2007
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    anyone?

  • #5
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,039
    Thanks
    19
    Thanked 42 Times in 42 Posts
    comp url = www.siteurl.com/page.php?dev=comp&articleid=1032
    mobile url = www.siteurl.com/page.php?dev=mob&articleid=1032
    PHP Code:
    $dev $_GET['dev'];
    include(
    $dev.'.php'); 

  • #6
    New to the CF scene
    Join Date
    Aug 2007
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    sorry I'm a tad bit ignorant, the include function actually sticks the text from the php file into the page, but what does $dev = $_GET['dev']; do?

  • #7
    Senior Coder
    Join Date
    Apr 2007
    Location
    Quakertown PA USA
    Posts
    1,028
    Thanks
    1
    Thanked 125 Times in 123 Posts
    It gets the value of the variable "dev" from the url.

    So, in rafiki's example urls, it would return either comp or mob
    Last edited by PappaJohn; 08-14-2007 at 03:38 PM. Reason: typo


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •