main
side
curve
  1. Welcome to the new boards! Details here!

Complex idea / theory...

Discussion in 'Fan Sites' started by dark42, Jan 19, 2003.

Thread Status:
Not open for further replies.
  1. dark42

    dark42 Jedi Youngling star 3

    Registered:
    May 16, 2002
    Yeah, this is a bit crazy. I came up with the XML part half-way through, but I just learned XML a week ago... and not too well. Anyone who has insight to these problems, please help! Thanks a ton!!

    Here's the working-examples:
    [link=http://benjaminchait.home.attbi.com/xmlq/index.htm]http://benjaminchait.home.attbi.com/xmlq/index.htm[/link]


    Note: this is a wee bit complex. I could always have all of the html on each page like a normal person, but that would take too much work when I re-coded a page. Anyone who takes time to read this - THANK YOU!!
    Note 2: I had a lot to say.

    -----------

    What I currently do for my site is design a template, translate it to javascript, then each page (like index.htm) will have the variables to load the specific page content (ie the page itself, a menu, the page name).

    How can I make this fast and efficient? (Server-side scripting?)

    -------

    Say I have "index.htm" - this is what it currently looks like:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <script>
    var lvl = '../'; //this is for all of my hyperlinks, so I can have them in my template
    var pgsrc = 'index2.js'; //this tells what is displayed
    var pgtitle = 'home'; //this is referenced for the page image on the left
    var quicklinks = 'quicklinks.js'; //this tells what to display in my menu to the right
    </script>
    </head>

    <script language="JavaScript" src="../page/page.js" type="text/javascript"></script>

    </html>

    ------------

    So the template is page.js (plus pageb.js and pagec.js because of javascript issues).

    A quick view of my template is this:

    (all in "document.write('');" because of javascript)

    ------------

    page.js:
    head
    title
    scripting
    stylesheet
    /head

    body
    <script language="javascript" type="text/javascript" src="PGSRC variable here"></script> [b]this loads my page data here, defined by the html file[/b]
    <script language="javascript" type="text/javascript" src="pageb.js"></script> [b]because i can't have document.write('<script...'); I have to make another .js for my template each time I load some data onto my page, else javascript just quits working and thinks that it's plain text again[/b]

    -----------

    pageb.js:
    <script language="javascript" type="text/javascript" src="QUICKLINKS variable here"></script> [b]loads my menu[/b]
    <script language="javascript" type="text/javascript" src="pagec.js"></script> [b]again, gotta go to another page b/c of javascript[/b]

    ----------

    pagec.js:
    footer
    /body
    /html

    And that's all of my template.

    ----------

    That's a bit crazy. And I don't like using javascript because it makes me code my index.js with document.write('stuff'); instead of normal text or html code (I have to add the document.write('<a href="etc">'); like such to html coding, thus doubling how much work I have.

    As well, I would like to try to get just get ONE file for my template, and have it reference each part afterwards. [b](Wondering, is it possible to embed an XML file right here and have that be my display?)[/b]

    ---------------

    I would like to know if I can do this through XHTML (I'm trying to learn this one), but it doesn't seem too apparent. What I'd like is to have a template as an XSL file, then load the individual XML file as my source file (defined by a variable in each page).

    -------------

    Like such...

    [b]xml file[/b]
    a<?xml version="1.0" encoding="ISO-8859-1"?>
    <page>
    <name>home</name>
    <content>Welcome to my web site!!</content>
    </page>

    [b]But how do I get XML to read HTML coding? Say I want a hyperlink... how would I code that in XML?[/b]

    [b]xsl file[/b]
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
    <html>
    <body>
    Page name: <xsl:value-of select="page/name"/><br/>
    Page contents:<br/><xsl:value-of select="page/content"/>
    </body>
    </html>
    </xsl:template>
    </xsl:stylesheet>

    [b]htm file[/b]
    <html>
    <body>

    <script type="text/javascript">
    >
     
Thread Status:
Not open for further replies.