Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Looking for a simple way to insert some text into the detailed.html pages.

Quote Reply
Looking for a simple way to insert some text into the detailed.html pages.
Hi,

I have a template global that is changed on an almost daily basis (not everyday however), and it contains nothing more than simply the date in the format of Month Day, Year

I need to insert this into every detailed page that gets built, in other words every links record in the system has this show up on it's detailed page.

However, since I am changing the "date" in the template global on an almost daily basis, this requires rebuilding the entire system every single day, which as the system grows takes more and more horsepower to do.

So Im looking for a simple solution that would allow me to insert the date into the detailed pages.

I've tried the following code:
Code:
<object width="600" height="20" type="text/plain" data="/decks/price.txt" border="0" style="overflow: hidden;">
</object>

And thought I had the perfect solution because it looks great in Firefox, however loading up the pages in Internet Explorer had it looking like an iframe and the date wasn't showing at all unless someone were to scroll down with the little up down arrows, and it gave it a 3d looking effect of a box within the page which is not what I want. I simply want the date that I can store in either a simple txt file on my server to show up on the detailed pages so that I only have to build the changed files when needed instead of having to build all every day that the date changes.

Does anybody have an simple solutions to doing this?

My preference would be to do it all within Links Admin, maybe creating a new template page named pricedate.txt or pricedate.html and somehow (through Javascript maybe?) pull the text of that template page into the detailed pages for each record. However it appears that will be a problem since the template pages are stored within the admin area and it would require a user supplying the admin control panel username and password just to see the date. Obviously not a good solution. So Im open to other suggestions on how to do the above using the Links system, and all through the admin panel if at all possible. At worst case, I'll have to ftp into the server every time the price changes and upload the new text file I suppose.

But mainly I've got to find a solution to make it display properly in Internet Explorer, for as it is now it looks as if I've added an iframe page to the detailed pages with just a date in them and looks wacked.
Quote Reply
Re: [Westin] Looking for a simple way to insert some text into the detailed.html pages. In reply to
Hi,

So the template /decks/price.txt exists where about one your server? You could just try:

<%include /full/path/to/decks/price.txt%>

..and that should work fine for what you need.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Looking for a simple way to insert some text into the detailed.html pages. In reply to
Can it really be this simple?


Of course it can. And for those that are interested, if you need to do something like this yourself.

1. Use Links Admin to create a new template (name it what you like, for me this tme it was price.txt)
2. In the detailed.html template place <%include ./local/price.txt%> wherever you want it to show up.

I spent a good 10 minutes or more trying to figure out why it kept telling me that it couldn't find the price.txt file when I know for certain that it exists and as it turns out, I think that links reads the folder structure differently then what I'm used to, so putting
/home/path to account/domain/admin/templates/luna/local/price.txt
I finally put in ./admin/templates/luna/local/price.txt
Which returned the error message:
Error can't include ./admin/templates/luna/local/home/path to account/domain/admin/templates/luna/local/price.txt

So this told me that the path when using the include is relevant to the admin/templates/luna folder. So just adding ./local/price.txt tells Links system enough to know that the file actually exists at /home/path to account/domain/admin/templates/luna/

Anyway, that is a great long explanation to just say, you can use ./local/your_template_name.extension as the path If you need to include the contents of a template you created in the Links Template system.

Thank you Andy. You're good, you're really good!
Quote Reply
Re: [Westin] Looking for a simple way to insert some text into the detailed.html pages. In reply to
haha glad it worked :) (joys of working with GLinks for so many years - you learn a few tricks Whistle)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Looking for a simple way to insert some text into the detailed.html pages. In reply to
Oh wait, this won't work except in the dynamic pages (page.cgi) which we don't use for all that much due to the huge amount of ifs and or buts in our detailed.html template because it's just going to write the contents of the price.txt file into the page when it builds the pages, so it will still be outdated unless I do a build all which is what I'm trying to avoid.

I guess I need something more dynamic that is included in static html pages that Links system builds so that it can include the contenst of the price.txt file changes in the static html pages that get built.

The object system I listed above is simple to implement but looks terrible in Internet exploder due to how it renders the object content.

Maybe javascript to include contents of a text file in a static html page?
Quote Reply
Re: [Westin] Looking for a simple way to insert some text into the detailed.html pages. In reply to
You coudl just try:

<iframe src="http://www.google.com" width="200" height="100" scrolling="no"></iframe>

Obviously just replace the google.com stuff with the URL to the file you want to show =)

(may need a little CSS to get rid of the borders)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Looking for a simple way to insert some text into the detailed.html pages. In reply to
Yeah, that was my first thought on how to do it, I don't know if the info has changed or not but seems from what I've read it's better to use the object tag instead of the iframe, either way they both produce that awful 3d looking border even when the border is set to 0.

I guess if that's the way to do it, then I'll have to manually update the price.txt file and put it somewhere outside of the admin panel else everybody will be prompted to enter a username and password for every page that they access that has that on it.

So, I've got to figure out what in a css file can (if anything) control the ugly 3d border that I.E. puts on iframes and objects, and manually ftp the price.txt file to the server everytime I update the price tables, OR I scrap the entire thing and just let people guess when the last price update was done. Hmmm, the second method is looking more friendly to me all the time.

I guess I was just hoping for some magical way that Links would be capable of dealing with this that maybe others can't. The only thing I can see is to use Links in dynamic mode only, but that's just too costly in terms of processing power on a shared server.

Last edited by:

Westin: May 15, 2009, 9:35 AM
Quote Reply
Re: [Westin] Looking for a simple way to insert some text into the detailed.html pages. In reply to
Just use this in the IFRAME:

Code:
frameborder="0" style="border: 0px;"

That will stop it showing borders.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Looking for a simple way to insert some text into the detailed.html pages. In reply to
Ah great. This will serve double duty, I just figured out that another thing I can do with this is to put a small(ish) iframe at the top of all the pages by putting one up at the very top of the include_header template that pulls in a news.html file, set the scrolling to auto, and whenever I want to put out important news (like maybe database maintenance, I can write simple text with font tags and what not else in the news.html file and put it on the server. In this way people that visit will see the message at the top of every page, and when there is no news to give people, simply leave the content of the news.html file blank and all they'll see is a blank spot about 50px tall at the top of the page which also serves double duty since I wanted to drop the site down by that much from the top of the browser window.

So when there is new to post, simply add it to the news.html page, and it will display on every static and dynamic page in a small 2 line text that has the scrollbar if needed but has no border, and when there isn't news, leave the news.html file empty and they won't get the scroll bar and or see anything at all other than the blank white space that I wanted to have at the top of the site anyway.

And of course I can add the iframe now where I want the date to show up too without the annoying border.

Very cool.

Last edited by:

Westin: May 16, 2009, 2:45 AM
Quote Reply
Re: [Westin] Looking for a simple way to insert some text into the detailed.html pages. In reply to
My Suggestions:

Ajax Includes script is the one that will do exactly what you need it to do, this script uses Ajax (DHTML interacting with the server) to let you dynamically include the contents of an external page onto the current document. It's similar in function to the Iframe SSI script below, though uses no frames.
http://www.dynamicdrive.com/...cindex17/indexb.html


Adding suggestion:
Create a new template possibly call it detailed_time.html ad the script code to that location. In this way, you can change the external page with the new date and time daily and NOT have to rebuild any of your detailed pages to ensure the changes take place.


Sandra Roussel
Chonsa Group Design - Fresh Start Housing
Quote Reply
Re: [Westin] Looking for a simple way to insert some text into the detailed.html pages. In reply to
Quote:
I guess I was just hoping for some magical way that Links would be capable of dealing with this that maybe others can't.
Offcourse there is, just think outside of the box & combine the option of having both dynamic and static site.
Don't give up this early my friend. You have yet to even scratch the surface of GLinks features.


Assuming that the data that is being updated on regular basis is mainly to be served to end users and if you are not really intersted in using iframes, than there is a way around it. Mind you though, if it was not because of Andy and Laura, I would not have found the answer myself - so even if it works out - remember to thank them instead.

Why not simply setup a custom page in GLinks, call is via http://www.domain.com/path/page.cgi?p=pagewithspecialdataonly

Now how to display the data:
Dynamic Pages: As mentioned above, you can simply use <%include %> function
Static Pages: Use SSI or php include function (depending upon the extensions of your pages)

I am currently using the same function and its working just fine.

Hope this helps.

Vishal
-------------------------------------------------------
Quote Reply
Re: [SWDevil.Com] Looking for a simple way to insert some text into the detailed.html pages. In reply to
Is there a difference resource wize between using an Ajax script or an Iframe? Is one more supported than the other? Can either of them be turned off or on depending on the end users browser settings?

The special data that needed to be displayed was only a small blurb of text, so it doesn't warrant a whole page for it. I'll have to check with my host, but Im pretty sure that anything that will have the abilities to of ssi needs to be named shtml and anything for a php include would have to be php or php3

And while I could name all the pages in Links to shtml, it would seem a waste of resource power if they have to run through the server when there is nothing on the majority of pages that require it.

Running things dynamically are substantially slower on our server than it is to output static html pages so I try to avoid it if possible, where a regular static page pops onto our screen and is done loading from the server in no more than 3 seconds, if I run it through page.cgi to display that same page, it might take anywhere about 5 seconds before anything starts to happen, and complete around 7 to 10 seconds. I gave up running my own web hosting business a few years ago so don't really care to go back to doing it for my own sites even though I know that issue would be solved by being the only account on the server. The more I look at the code of the detailed.html teplate the more I worry it's going to bring the server down heavily as it's getting quite extensive with all the if's and elses and endifs, since each page has a possible 55 collectible cards on it and Glinks is having to manipulate all those cards data quite a lot now. It's not fun to watch a build all while it trys to run through the individual detail pages to build as each one takes between 3 and 7 seconds to build. I can only imagine my host is not going to be pleased when there are thousands or tens of thousands of records and I have to do a build all. Im hoping to avoid that as much as possible later on in the websites lifetime.

Thanks for all the suggestions, maybe I'll have to look into ajax, and see how reliable it is, if it's a resource hog on the browser etc. I know that my Internet Explorer 8.0 seems to struggle with iframes, as scrolling down a page with more than one iframe on it seems to make it jerky to scroll down the page.

Last edited by:

Westin: May 16, 2009, 7:02 PM