Solved

how to force a page to use my css instead of the his!

Posted on 2004-04-21
11
333 Views
Last Modified: 2006-11-17
So, I made my own homepage w/ frames and there's one link that opens a different page in my mainframe, but it has it's own build in css that i cannot change. Is it possible to make that page use my css?
I heard that there's a way to make a php page that copies the original one and edits it on the server. I.e. it opens a page, takes away the css data and background image links and put mu information in it, and i happens averytime someone opens that link or refreshes it. How can it be done.
How can this be done or maybe there's a different war to do that

Here's the link to my problem: http://lgm.mfs.lv/EN/
If you click on the link on the left side "STANDINGS" it opens a different page in the mainframe, but i want it to make w/ white background and different link color(a different css)

Please tell my where I can find the information to do this. Thanx.
0
Comment
Question by:GuanoFun
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +1
11 Comments
 
LVL 9

Expert Comment

by:pepsichris
ID: 10877682
The standings page doesn't work for me - I get a connection timeout as I'm at work and can't access port81 without unwarranted hassle.  However, your first job would be to ask their permission.  Send them an e-mail and ask them.

The address which you're linking to looks like this:

http://www3.igl.net:81/perl/show.cgi?ladd=latgolf&genre=strategy&svr=cgi2&template=myleague&range=All%20Active%20Players

The interesting part is the template=myleague.  That suggests that they already have some form of system in place for formatting the results differently, which you might be able to tailor to your needs, but you can't do it from your end without their permission and a few things set in place.

I don't know if you've already asked their permission or not, but if you haven't then you shouldn't be displaying their page within your own frameset.  Get in contact, explain the situation, and I'm sure they'll do what they can to help you.
0
 
LVL 6

Expert Comment

by:pkaleda
ID: 10877797
Here is one thought.  Instead of linking to his page directly, you can use some scripting engine (Perl, ASP, PHP) to grab the code on his page and then write it to a new page that you then dispaly.  While you are doing that you can strip his style sheet link off and replace it with a link to your style sheet.  You can also strip off his body tags and replace them.

Here is an example of how to generally do it in ASP:

Create the new page you want to link to and save it as new.asp.  This is the code on it:

<%
<SCRIPT LANGUAGE=vbscript RUNAT=Server>
Function GetHTML(strURL)
on error resume next
  Dim objXMLHTTP, strReturn
  Set objXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")

  objXMLHTTP.Open "GET", strURL, False
  objXMLHTTP.Send    
  strReturn = objXMLHTTP.responseText
  Set objXMLHTTP = Nothing

  GetHTML = strReturn
End Function
</SCRIPT>

'Define URL
Myurl = "http://www3.igl.net:81/perl/show.cgi?ladd=latgolf&genre=strategy&svr=cgi2&template=myleague&range=All%20Active%20Players"
'Retreive URL
retval = GetHTML(myurl)
'Source Replacement
Source = replace(server.HTMLEncode(retval),chr(13),"<br>")
Source = Replace(Source, "<LINK REL=StyleSheet HREF=http://www.myleague.com/latgolf/main.css TYPE=text/css>", "Put your new style sheet link here")
'You can put more changes here if you want them.

'This writes the modified code to the page for you to display
Response.write(Source)
%>

It will then write the code of the old page to new.asp with your sytle sheets.

You have to make sure that you have permission to change his page first.  There are copyright issues there.

PK
0
 
LVL 1

Accepted Solution

by:
felixcattus earned 300 total points
ID: 10878062
pkaleda has the right idea, I was going to suggest the same thing, but in PHP.  I did something similar with PHP to search the remote page and redraw two data tables from a remote site (as if I was connecting to their database directly - hehe)

Here's what I would do in PHP in your case:

<?php

//first, get the html code of the page
$parsed_page = file_get_contents("http://www3.igl.net:81/perl/show.cgi?ladd=latgolf&genre=strategy&svr=cgi2&template=myleague&range=All%20Active%20Players");

//define your own head and css tag
$starter = '<HTML><LINK REL="SHORTCUT ICON" HREF="http://www.domain.abc/verzeichnis/dateiname.ico">';

//get only specific portion of the page - starting at body
$start_at = '<BODY'; //note no closing > (because there is more code , like BGCOLOR, etc...

//get the numerical position of the start of <BODY
$pos_start = strpos($parsed_page, $start_at);

//return only from the '<BODY' on
$parsed_page = substr($parsed_page, $pos_start);

//then echo the page code
echo $starter;
echo $parsed_page;

?>

That should do it!
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Expert Comment

by:felixcattus
ID: 10878099
Oh - one other thing - obviously the link

<LINK REL="SHORTCUT ICON" HREF="http://www.domain.abc/verzeichnis/dateiname.ico">

would go to the CORRECT style sheet, or if you want, have it the multiline listing of styles like you already have.  Just put it all into the $starter variable.

Guess that would look like this:

$starter = '<HEAD><style type="text/css">
<!--

a {text-decoration: none; font-size: 9pt  }

    body{
      scrollbar-base-color: #FFFFFF;
      scrollbar-arrow-color: #003399;
}

-->
</style>
<STYLE type=text/css>PRE.clsCode {
      FONT-SIZE: 110%
}
PRE.clsSyntax {
      FONT-SIZE: 100%
}
</STYLE>

<STYLE>BODY {
      FONT-FAMILY: verdana,arial,helvetica; MARGIN: 0px
}
</STYLE>
';
0
 
LVL 9

Expert Comment

by:pepsichris
ID: 10878228
Can't stress how important it is to get their permission before you even start playing with stuff like this, though.
0
 
LVL 6

Expert Comment

by:pkaleda
ID: 10878322
I agree with Pepsichris.  You can open yourself up to legal action and monetary damages for changing their information without permission.  You can freely link to other peoples public pages, but cannot modify it without their permission.

PK
0
 

Author Comment

by:GuanoFun
ID: 10885938
There's no problem of displaying it into my iframe, but thay refused to help my w/ the css data :(
I'll try to work out rout ideeas, but somehow they are not working :(
0
 

Author Comment

by:GuanoFun
ID: 10886035
I did a lot of work and got out this ... :(

Warning: file_get_contents(): URL file-access is disabled in the server configuration in /data/www/htdocs/www.mfs.lv/abols/test.php on line 4

Warning: file_get_contents(http://www3.igl.net:81/perl/show.cgi?ladd=latgolf&genre=strategy&svr=cgi2&template=myleague&range=All%20Active%20Players): failed to open stream: no suitable wrapper could be found in /data/www/htdocs/www.mfs.lv/abols/test.php on line 4

I guess this means that i have no permissions to get the file contents from the hp ... any other ideas?
0
 
LVL 6

Expert Comment

by:pkaleda
ID: 10887710
Using my asp method gets the code as it is displyed, not trying to access the file from the server.  You can run ASP on many linux based Apache servers.
0
 

Author Comment

by:GuanoFun
ID: 10887939
well i forgot to tell that i have a simple ftp html server :(
0
 

Author Comment

by:GuanoFun
ID: 10899856
Ok, It's not working on my server but i tested it on a friends server, it worked, so a big thanks :)
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Get to know the ins and outs of building a web-based ERP system for your enterprise. Development timeline, technology, and costs outlined.
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question