As was foretold, we've added advertisements to the forums! If you have questions, or if you encounter any bugs, please visit this thread: https://forums.penny-arcade.com/discussion/240191/forum-advertisement-faq-and-reports-thread/

HTML: Pulling an unordered list from an external file?

Sir CarcassSir Carcass I have been shown the end of my worldRound Rock, TXRegistered User regular
edited June 2012 in Help / Advice Forum
So I'm using Bootstrap to develop this site. I'm using the modal class to display a modal when a button is clicked to show a revision history of the contents of the site, which is updated every quarter. Eventually this is going to get very unwieldy if the history is put in the main html file. Is it possible to have the the list data in another file and have the modal pull it?

Here is the code I'm using:
<div class="modal hide fade" id="chipRevision">
		<div class="modal-header">
			<a class="close" data-dismiss="modal">x</a>
			<h3>CHIP Revision History</h3>
		</div>
		<div class="modal-body">
			<ul>
				<h1>June 2012</h1>				
				<li>PTB letter retired</li>
				<li>ADN letter version date changed to 04/17/2012</li>
				<li>CAQ letter version date changed to 05/30/2012</li>
				<li>CSC letter version date changed to 05/01/2012</li>
				<li>ROL letter version date changed to 04/17/2012</li>
				<li>CAF version date changed to 05/31/2012</li>
				<li>CHIP Member Guide version date changed to 0312</li>
				<li>Comparison Charts version date changed to 0512</li>
				<li>Letters with version date changed to 03/08/2012: ACR, AMW, APC, APL, BOL, BOR, CIF, CIQ, CMW, CRC, CRP, CSM, DNS, DRL, E1R, ECN, EFX, EMC, EMI, EPM, EPR, ERN, HCC, HNR, HPC, HPD, LRR, MPC, MPL, PFN, PLN, PRN, RAC, RCN, RFN, RLN, SMI, TCD, TEG, UPR, VAC, VIK, VRR</li>
			</ul>
		</div>
	</div>

So ideally I would like to put that ul in a separate file and reference it there. Is there an easy way to do this, or should I just put this stuff at the bottom and deal with it?

Sir Carcass on

Posts

  • bowenbowen How you doin'? Registered User regular
    Not with straight HTML. You may be able to trick it with javascript/ajax. You can easily do it with php/asp though.

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • TejsTejs Registered User regular
    bowen wrote: »
    Not with straight HTML. You may be able to trick it with javascript/ajax. You can easily do it with php/asp though.

    Is it sad that I was looking for the +1 arrow for this post? I spend too much time on StackOverflow =D

    Alternatively, you can simply make an iframe in HTML to pull in another HTML file that is simply this content. Then you don't need javascript or any server side resources.

  • RendRend Registered User regular
    bowen wrote: »
    Not with straight HTML. You may be able to trick it with javascript/ajax. You can easily do it with php/asp though.

    This is correct.

    With some "creative" css you could also put it at the bottom of the page, so as to be the least amount of unwieldy possible, and have it display wherever you please anyway. However, in order of usability, iframes, js, and this method are all categorically inferior for this purpose than either asp or php.

  • AftyAfty Registered User regular
    Meh I don't really like iFrames, however, if it works...

  • bowenbowen How you doin'? Registered User regular
    There are much easier ways than iframes.

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • RendRend Registered User regular
    I would never actually recommend an iframe to someone. However, between a javascript file with the lines coded, css placing stuff inappropriately on a page, and an iframe, the choice is pretty clear. It is still a dubious honor to be the best of the worst, though.

  • Sir CarcassSir Carcass I have been shown the end of my world Round Rock, TXRegistered User regular
    php is out because I don't know it and this is due in like 2 weeks. I think for now I'll just include it at the bottom of the html file. It doesn't show on the page, just in the modal that pops up, so it doesn't really matter where I put it in the html. It's just that eventually this would get to be several pages long. I'll check out iframes, though.

  • RendRend Registered User regular
    php is out because I don't know it and this is due in like 2 weeks. I think for now I'll just include it at the bottom of the html file. It doesn't show on the page, just in the modal that pops up, so it doesn't really matter where I put it in the html. It's just that eventually this would get to be several pages long. I'll check out iframes, though.

    For what it's worth, php is absolutely simple to learn, especially for functionality this basic. And asp is actually just C# but on the internet, or so it looks like to me, unless I am completely off-base.

  • bowenbowen How you doin'? Registered User regular
    ASP.NET can be anything that can be interpreted to .NET bytecode if I recall. ASP proper was a wacky VB language. PHP would probably be the best choice if you were going to do one.

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • wmelonwmelon Registered User regular
    Honestly, If it's going to be that much content, I'd say don't put it in a modal dialog at all. Break it out into it's own page so that you don't have to worry about the dialog getting so big that you can't read all of the content.

  • Sir CarcassSir Carcass I have been shown the end of my world Round Rock, TXRegistered User regular
    wmelon wrote: »
    Honestly, If it's going to be that much content, I'd say don't put it in a modal dialog at all. Break it out into it's own page so that you don't have to worry about the dialog getting so big that you can't read all of the content.

    It's not a problem of the actual display. It's a revision history with the most recent first, so the few people using this (it's not actually on the web) would really only care what was done in the last quarter, but the rest of the history is there if they want it. It was mainly to avoid the main html file getting too long, but just having it in a separate page entirely isn't a bad idea. I'll give it some thought. (the modal looks really cool though)

Sign In or Register to comment.