Reply
Loading a chunk of HTML as an object from a master file?
Old 12-12-2007, 09:11 AM Loading a chunk of HTML as an object from a master file?
Novice Talker

Posts: 8
Name: Steven
It is possible to clump together a chunk of HTML, stick it in a ‘master file’ and call it up on my webpage instead of having to rewrite the HTML for that object every time it appears on the page?
Maxamillious is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Old 12-12-2007, 09:42 AM Re: Loading a chunk of HTML as an object from a master file?
chrishirst's Avatar
Super Moderator

Posts: 12,742
Location: Blackpool. UK
http://www.candsdesign.co.uk/articles/coding/includes/

Server Side Includes
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 12-12-2007, 10:44 AM Re: Loading a chunk of HTML as an object from a master file?
wayfarer07's Avatar
$frontend->developer

Posts: 848
Name: Abel Mohler
Location: Asheville, North Carolina USA
I use php. The format is:
PHP Code:
<?php include 'wherever/whatever.inc'?>
The included file should not have a header, title or anything like that, unless it is needed(for example including a common header). It can be HTML, Javascript, or more php code.
__________________
wayfarer07 is offline
Reply With Quote
View Public Profile
 
Old 12-12-2007, 11:02 AM Re: Loading a chunk of HTML as an object from a master file?
Novice Talker

Posts: 8
Name: Steven
Oh wow, thank you very much! This makes my life much easier now.

Now, in the instance I’m using SSI for a button (or anything else really), how would I apply different text to the button each time it’s called up?
Maxamillious is offline
Reply With Quote
View Public Profile
 
Old 12-12-2007, 02:25 PM Re: Loading a chunk of HTML as an object from a master file?
chrishirst's Avatar
Super Moderator

Posts: 12,742
Location: Blackpool. UK
For something like that I would use a function
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 12-19-2007, 06:26 PM Re: Loading a chunk of HTML as an object from a master file?
Novice Talker

Posts: 8
Name: Steven
I’m not really understanding what you mean by use a function with SSI. I’ve done some browsing around and none of the tutorials and guides that I’ve read have made any reference of functions in relation to SSI.

Could you please explain?
Maxamillious is offline
Reply With Quote
View Public Profile
 
Old 12-19-2007, 07:50 PM Re: Loading a chunk of HTML as an object from a master file?
chrishirst's Avatar
Super Moderator

Posts: 12,742
Location: Blackpool. UK
You don't actually make a function in SSI. You include a file that has the code to write out the required HTML.

eg:
To write a button that changed (as buttons do) captions etc:

Code:
<%
sub writeButton( sType, sName, sID, sValue)
dim quotes
quotes = chr(34)

with response
	.write "<input "
	.write "type="
	.write quotes
	.write sType
	.write quotes
if sID <> "" then
	.write " id="
	.write quotes
	.write sID
	.write quotes
end if
if sName <> "" then
	.write " name="
	.write quotes
	.write sName
	.write quotes
end if
if sValue <> "" then
	.write " value="
	.write quotes
	.write sValue
	.write quotes
end if
	.write ">"
	.write vbcrlf
end with
end sub
%>
And to use it you pass the required parameters
Code:
<%writeButton "submit", "go", "go_btn", "Go Here"%>
that example would write on to the page;
HTML Code:
<input type="submit" id="go_btn" name="go" value="Go Here">
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to Loading a chunk of HTML as an object from a master file?
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.16066 seconds with 13 queries