Forum Moderators: open

Message Too Old, No Replies

Replacing/Erasing Page content?

         

gizzmo

5:16 pm on Feb 24, 2004 (gmt 0)

10+ Year Member



hi,
i have a problem...
i'm creating a html based viewer for a page that's full of stuff i don't need, and doesn't have a good navigation system, hence i'm building my own.
now i have a problem...there's no use in using the pages as they exist on the server, as they include all the stuff i don't want.
i already contacted the webmaster, there's no way to access the pages i want w/o loading the rest by just using another address or something.

what i need is a script that allows me to replace or erase content, by looking for certain strings and replacing them, showing me the result.

in short: a script through which i load a page w/o the content i don't want.

i'm not capable of writing it myself, so i was wondering if such a thing already existed, or if you could point me in the right direction....

thanks a lot.

DrDoc

5:20 pm on Feb 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to Webmaster World!

This type of solution is always best handled server-side. Do you have access to a server side language such as ASP/PHP/Perl?

gizzmo

6:42 pm on Feb 24, 2004 (gmt 0)

10+ Year Member



thanks for the reply!

no, that's the problem.
if i had access to the serverfiles, i'd just create my own templates and fill them with data. but that's not the case, i have to work with html files, and can only edit those on the fly.

i know such scripts exist, i read about people using them to replace certain user information to make them look better on ebay...
don't want to crawl all the underground sites to find one tho, and google didn't help so far.

DrDoc

9:01 pm on Feb 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The problem with JavaScript handling such functionality is that you need to mess with nodes, which are only supported in more recent browsers. Also, it would be extremely hard to write something that works on a number of pages, allowing each page to be different.

gizzmo

9:25 pm on Feb 24, 2004 (gmt 0)

10+ Year Member



well, i don't need to remove different elements, it's always the same elements, even tho it's different pages...like "search for a certain string on the page ur loading and remove it"

DrDoc

10:44 pm on Feb 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ok, a couple questions then:

1) Does that string always appear in the same spot?
2) Does the element containing the string contain anything else (other text or whatever)?
3) Does the element containing the string have an ID attribute?

gizzmo

11:07 pm on Feb 24, 2004 (gmt 0)

10+ Year Member



1) yes, it does, always the same content.
2) there are other elements, well, it's a part of the page, so it includes links, text, images.
3) i don't think so, just a normal html page, generated by php.
to be precise: it's a bulletin board, and i want to remove all the navigation elements and a banner, so the page is only being displayed starting at a certain point....
to take this page as an example...let's say i want to remove the banner, the "Welcome gizzmo:
control panel, site search, glossary, subscribe, help, library, Publishers Conference, recent posts ", and only leave everything below, starting with "Home/Forums....etc".

hope that makes it clear ;)
isn't there any command to find a string, and one to replace it? i'd be surprised if there wasn't, as it can be found in even the simplest programs, and i'm not referring to the standart text-search engine provided by most OS, but rather search-and-replace features.

if it's not really possible with java, is there any other scripting language that would be able to do that in an easier way? i don't need to do it in java, just thought it might be the common way to do such things client-side.

DrDoc

11:34 pm on Feb 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Any non-client side solution would be better ;)

Do you know regular expressions?

gizzmo

7:05 pm on Feb 25, 2004 (gmt 0)

10+ Year Member



kinda, i've read about them, and understanding stuff like that has never been hard for me...
btw: i checked the ebay thing, and it was a bug of javascript, not a normal function, as i thought.
tho i still don't understand why someone would make a language which is not capable of simple...let's say search and destroy...

check this out: [java.ittoolbox.com...]

still havn't found the code tho.

DrDoc

7:09 pm on Feb 25, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Oh, JavaScript is capable of search and destroy... Just not fully capable of loading a page, and outputting "all except this"...
JavaScript was never meant to handle that kind of functionality, seeing how it is a client side scripting language. You're meant to handle those kinda things on the server side. So, no matter the solution you're looking at -- it's going to be a very roundabout way of doing it, and it may not always work the way you expect. Also, JavaScript won't be able to do anything about those tags until after the page has already loaded... And that is probably not a desired effect either.

gizzmo

8:59 pm on Feb 25, 2004 (gmt 0)

10+ Year Member



before going on, i have to say thanks for the great help, it's much appreciated!

well, i think i get what you say.
i think by outputting you are alos thinking about not displaying...i don't even need to erase the stuff, it's be sufficient to make it invisible, i.e. (and i don't know if that's possible either) having a script that searches for strings and adds invisibility tags around them. thinking about it, i think that might even work...waht do you think?

as to loading the page in advance: at this point, i don't care about this extremly small amount of traffic anymore...i already have the pics locally, and gonna exchange those <img=...> with local addresses using a script (i think that's gonna be easier, seen it in many places).