Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

method to import text as html in a page 2

Status
Not open for further replies.

CubeE101

Programmer
Nov 19, 2002
1,492
US
Is there a way to import text as html in a web page...

...similar to the way you can import a .js file as script in a script tag?

Such as:
Code:
<Script lang="text/javascript" src="blah.js" />

For example...
Rent A Coder has this code you can paste into your site:
Code:
	<IFRAME ID=IFrame1 FRAMEBORDER=0 SCROLLING=NO width=150 Height=300 
		SRC="[URL unfurl="true"]http://www.RentACoder.com/RentACoder/misc/LinkToUs/ScrollingBidRequests.asp?txtWidth=150&txtHeight=300&blnHideChannelSubscribe=true&blnLaunchLinkInNewWindow=true&blnFullTitle=true&txtBgColor=white"[/URL] 
		height=300>
		Your browser does not support inline frames...However, you can click 
		<A 
		href="[URL unfurl="true"]http://www.RentACoder.com/RentACoder/misc/LinkToUs/ScrollingBidRequests.asp?blnHideChannelSubscribe=true&blnLaunchLinkInNewWindow=true&blnFullTitle=true">[/URL]
		here</a> to see the related document.
		</IFRAME>
from THIS URL

But what if you want to save that as a text file, or something, and just import it into your page, to keep it uncluttered...


PROGRAMMER: (n) Red-eyed, mumbling mammal capable of conversing with inanimate objects.
 
depending on your server environment you can use either Server Side Includes or, for example, the PHP include() function.


Sorry for the double post... I had a mental block and clicked submit before I finished typing.

- Web design and ranting
- Day of Defeat gaming community
"I'm making time
 
>> Do you mean include a snippet of code in many pages?

Yes...

>> depending on your server environment you can use either Server Side Includes or, for example, the PHP include() function.

Can't use PHP, ASP, or any server side...
Can use client side, vb/java/jscript, html, xml stuff (xslt, dtd, etc...)

>> Sorry for the double post... I had a mental block and clicked submit before I finished typing.

No problem, I do it all the time ;-)

Is there not something like an <import> tag?
I have seen it, but no luck using it...

I guess I might could make a javascript (.js) file to use document.write to write the snippet in... but I was looking for a simpler method...


PROGRAMMER: (n) Red-eyed, mumbling mammal capable of conversing with inanimate objects.
 
Nope.
You won't be able to do this unless you have some kind of scripting ability on the server. Since that is where the page needs to be created.

Why can't you use the IFRAME method you used as an example?
What is it you need to include on the page?

- Web design and ranting
- Day of Defeat gaming community
"I'm making time
 
Using the standard
Code:
<!--#include virtual="/include.htm"-->
and then renaming the page extension of the page with that code on it to page.shtml won't work for you?

If that doesn't work I'd move to another host. That's about as basic as it gets.
 
Using the standard
Code:
<!--#include virtual="/include.htm"-->
and then renaming the page extension of the page with that code on it to page.shtml won't work for you?

If that doesn't work I'd move to another host. That's about as basic as it gets.
That's an SSI (Server Side Include)

I tend to agree about moving hosts if the current one won't let you do that.

- Web design and ranting
- Day of Defeat gaming community
"I'm making time
 
>> If that doesn't work I'd move to another host.

Nah...

It's a just for fun site... w/ a free host...


>> Why can't you use the IFRAME method you used as an example?

That looks like it will work...
Code:
<IFRAME SRC="import.html" width=100% height=100% FRAMEBORDER=0 SCROLLING=NO/>

*Note: It is going into a table, hence the 100%x100% and no border...

I didn't even think about that... (duh)

Don't you hate it when you (unknowingly) post the answer to your question in your question... lol

Thanks for the help!!! (I feel half past dumb right about now ;-))

I might use the #include later...

Thanks again,
-Josh


PROGRAMMER: (n) Red-eyed, mumbling mammal capable of conversing with inanimate objects.
 
Don't feel dumb. Half the time I post questions to forums, something about typing it out makes me figure out the answer and I have to post back in a few minutes saying "nevermind"

Even though my post didn't help, thanks for the star!
 
yeah... me too...

But I think that's the first time I posted a question about how to display something,
and the text I wanted to display contained the very thing I was asking about how to do... [hammer]

O Well... I guess I just defined irony;-) ... lol


PROGRAMMER: (n) Red-eyed, mumbling mammal capable of conversing with inanimate objects.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top