d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Seeking A Little Help. > Html/javascript
Add Reply New Topic New Poll
Member
Posts: 9,880
Joined: May 21 2009
Gold: 606.00
Mar 2 2013 04:13am
Problem: i have auto-generated html files that need to displayed on the same page. I will not know the exact name of the html file, but i can add a prefix to it if there's a way to somehow do this using prefix+wildcard or something. (javascript? Idk)

Just need a quick setup, nothing fancy.

Ex.
Log-randomstuff.html
Log-randomstuff2.html
Log-randomstuff3.html
Added to one page in columns or rows.



One more thing.
How would i go about displaying a page upsidedown? Not literally, but reverse the lines like this, if possible:

Line 1
Line 2
Line 3

To

Line 3
Line 2
Line 1
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Mar 2 2013 09:40am
So your html files are dynamically generated every time you visit the page and they're stored on your server? and they contain random stuff that you cannot control? that seems unusual. usually you have fixed files with placeholders/scripts to change content

typically you can put the script on your browser (grease monkey, ad-on, etc) or put it in your html file. i'm not sure how to put it on your site in such a way you can execute it on an html page without putting in your html page. but i'm not huge on web stuff.

as to reversing a page, that depends on what the html is and what you mean by reversing. if it's a very straight forward page, shouldn't be difficult to simply re-order the tags. but if it has a lot of css to align stuff, that's not going to be easy, especially if you don't know the format. or what if it's one big paragraph inside <p> with no <br/>? what does it mean to reverse that?

personally i'd look into how these files are generated and see what you can do about it. it would be best to generate content instead of actual files, i think.

This post was edited by carteblanche on Mar 2 2013 09:54am
Member
Posts: 11,610
Joined: Oct 28 2008
Gold: 1,795.00
Mar 2 2013 11:40am
Give an example of what one of the html files would look like.
Mar 2 2013 11:45am
Inappropriate Post Content
Mar 2 2013 12:54pm
Inappropriate Post Content
Member
Posts: 9,880
Joined: May 21 2009
Gold: 606.00
Mar 2 2013 01:19pm
Quote (0n35 @ 2 Mar 2013 13:54)
http://php.net/manual/en/function.file-get-contents.php

use this function to get and then format the contents to your likings


If there's a way to use a wildcard with that it would work nicely, such as: webroot/logfile-*.html
Dunno, gotta sleep im tired

thanks for the infos and such
Member
Posts: 10,812
Joined: Oct 15 2009
Gold: Locked
Warn: 20%
Mar 2 2013 02:56pm
not possible through html only. Use php or consider rethinking how you have things setup.

This post was edited by Azrad on Mar 2 2013 02:59pm
Member
Posts: 11,610
Joined: Oct 28 2008
Gold: 1,795.00
Mar 2 2013 03:09pm
Quote (Caleb7 @ Mar 2 2013 02:19pm)
If there's a way to use a wildcard with that it would work nicely, such as: webroot/logfile-*.html
Dunno, gotta sleep im tired

thanks for the infos and such


so there will continually be more files uploaded?

if they're numbered then this will be easy to do
Member
Posts: 9,880
Joined: May 21 2009
Gold: 606.00
Mar 3 2013 09:14am
Quote (0n35 @ 2 Mar 2013 13:54)
http://php.net/manual/en/function.file-get-contents.php

use this function to get and then format the contents to your likings


Since the html file is very small, I am going to add each full line to an array element, then use array.reverse() and re-write the page from the new array. So that problem is now solved.

Quote (Azrad @ 2 Mar 2013 15:56)
not possible through html only. Use php or consider rethinking how you have things setup.


Of course.

Quote (0n35 @ 2 Mar 2013 16:09)
so there will continually be more files uploaded?

if they're numbered then this will be easy to do


No numbering, but I can change the prefix to anything such as LOG-xxx1.html, LOG-xxx2.html, etc. I suppose I could find a way to make them numbers if I absolutely have to.
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll