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

    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:


    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">
    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 language="JavaScript" src="../page/page.js" type="text/javascript"></script>



    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)



    <script language="javascript" type="text/javascript" src="PGSRC variable here"></script> this loads my page data here, defined by the html file
    <script language="javascript" type="text/javascript" src="pageb.js"></script> 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


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



    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. (Wondering, is it possible to embed an XML file right here and have that be my display?)


    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...

    xml file
    a<?xml version="1.0" encoding="ISO-8859-1"?>
    <content>Welcome to my web site!!</content>

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

    xsl file
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsl:stylesheet version="1.0"
    <xsl:template match="/">
    Page name: <xsl:value-of select="page/name"/><br/>
    Page contents:<br/><xsl:value-of select="page/content"/>

    htm file

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