Results 1 to 6 of 6

Thread: Xml

  1. #1
    Join Date
    Feb 2009
    Posts
    159
    Thanks
    60
    Thanked 3 Times in 3 Posts

    Question Xml

    Is there any way to take the menu I found on here and place it in an external file like XML and then refer to it.

    I don't know XML but was thinking it might be the way to do this. Maybe there really is no solution to this, I don't know but let me explaine why I want to.
    I want to do this so that I can update any menu items on one page and have it translate through out all my pages with out having to place the code into a frame.

    <div id="myslidemenu" class="jqueryslidemenu">
    <ul>
    <li><a href="http://www.dynamicdrive.com">Item 1</a></li>
    <li><a href="#">Item 2</a></li>
    <li><a href="#">Folder 1</a>
    <ul>
    <li><a href="#">Sub Item 1.1</a></li>
    <li><a href="#">Sub Item 1.2</a></li>
    <li><a href="#">Sub Item 1.3</a></li>
    <li><a href="#">Sub Item 1.4</a></li>
    </ul>
    </li>
    <li><a href="#">Item 3</a></li>
    <li><a href="#">Folder 2</a>
    <ul>
    <li><a href="#">Sub Item 2.1</a></li>
    <li><a href="#">Folder 2.1</a>
    <ul>
    <li><a href="#">Sub Item 2.1.1</a></li>
    <li><a href="#">Sub Item 2.1.2</a></li>
    <li><a href="#">Folder 3.1.1</a>
    <ul>
    <li><a href="#">Sub Item 3.1.1.1</a></li>
    <li><a href="#">Sub Item 3.1.1.2</a></li>
    <li><a href="#">Sub Item 3.1.1.3</a></li>
    <li><a href="#">Sub Item 3.1.1.4</a></li>
    <li><a href="#">Sub Item 3.1.1.5</a></li>
    </ul>
    </li>
    <li><a href="#">Sub Item 2.1.4</a></li>
    </ul>
    </li>
    </ul>
    </li>
    <li><a href="http://www.dynamicdrive.com/style/">Item 4</a></li>
    </ul>
    <br style="clear: left" />
    </div>


    Thanks all
    Last edited by robin9000; 02-02-2009 at 08:39 PM.

  2. #2
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    Should be able to do it with php if your server has it. http://www.w3schools.com/PHP/php_includes.asp

  3. The Following User Says Thank You to bluewalrus For This Useful Post:

    robin9000 (02-02-2009)

  4. #3
    Join Date
    Feb 2009
    Posts
    159
    Thanks
    60
    Thanked 3 Times in 3 Posts

    Question Robin

    I know the hoster I am dealing with has support for PHP but after looking at the example and going through some of the pages, I am kinda confused as how to use it. Do I need to learn a hole new programing language to use it?

    The example I got from what you showed me is:
    <html>
    <body>

    <?php
    include("wrongFile.php");
    echo "Hello World!";
    ?>

    </body>
    </html>

    But I don't exactly understand how this is going to help. I cleary understand that you creat a PHP document and that the coding above is used to then refure to the PHP document. I get that part. But what I don't quite understand is do I have to code everything in PHP to create a document?

    I have tried to do it just as a server side include as follows:
    <!--#include virtual="menu.html" --> but it did not work, any reason why not?,
    It shows up like as if it's woking in my Dreamweaver but not in the browser.
    Last edited by robin9000; 02-02-2009 at 01:58 PM. Reason: adding

  5. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Yes, PHP is an entirely new language. It's very powerful. You do technically have to code everything in PHP to create a document, but PHP allows you to escape from the PHP parsing mode (in fact it is escaped by default) so you can write plain HTML and PHP will just print it normally.

    No, XML is not the way to go. You can do it in plain HTML with an include, as seen here, or with Javascript and DOM manipulation.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  6. The Following User Says Thank You to Twey For This Useful Post:

    robin9000 (02-02-2009)

  7. #5
    Join Date
    Feb 2009
    Posts
    159
    Thanks
    60
    Thanked 3 Times in 3 Posts

    Default

    Would it be posible to give me a small example of how the opening and closing tags would work inside the PHP document as so I can use html inside a php file?

    Thank you.

  8. #6
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Anything wrapped in <?php ... ?> (or, obsoletely, <? ... ?>, <?= ?>, or <script language="php"> ... </script>) is PHP code. Anything else will be treated as plain text or HTML and output verbatim (although PHP blocks and output buffers may be used to modify this).
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  9. The Following User Says Thank You to Twey For This Useful Post:

    robin9000 (02-02-2009)

Bookmarks

Posting Permissions

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