Hello, lets say I have bunch of hyperlinks. When link is clicked, I'd like an opened page (in a separate window) to have a google-translator style toolbox that I could use to save the page to a localdisk if I liked it, adding a few tags to the database using php. I understand how to save a file using php, but could You help me with ideas as how to add a toolbar and to send request from toolbar to my processing page? Here's graphic representation of my question.
views:
25answers:
2
+3
A:
You could have a page... say "extUrl" that contains the toolbar and an iframe where you could open the URL that your link may pass as GET parameter.
EDIT : I didn't use php for years so the code (untested) may need debug...
your link could be something like : <a href="/extUrl.php?url=http://stackoverflow.com/">SO</a>
And your extUrl.php file would look like :
[...]
<!-- here your toolbar -->
<?php
url = $GET['url'];
?>
<iframe src="<?php echo $url ?>"></iframe>
Vinze
2010-05-20 10:33:59
Could You elaborate/give an example, because it seems, that iframe lets open a link just from local domain and I need external. Otherwise I would have to do fancy javascripting.
arunas_t
2010-05-20 12:47:11
in editan example with pseudo php (not used this language since a while)
Vinze
2010-05-20 13:15:55
I accepted Your answer and added working code.Also I got partial information from http://www.htmlcodetutorial.com/help/ftopic2137-0-asc-30.html
arunas_t
2010-05-20 14:18:36
A:
Thanks, Vinze, You've put me on track, I've got the code working. I accept Your answer.
Links.html
<html>
<head>
<title> Links</title>
</head>
<body>
<a href="iframe.php?pg=http://www.google.com" target="_blank">Google</a>
<br />
<a href="iframe.php?pg=http://www.yahoo.com" target="_blank">Yahoo</a>
<br />
<a href="iframe.php?pg=http://www.ebay.com" target="_blank">Ebay</a>
</body>
</html>
Iframe.php
<html>
<body>
<div class="toolbar">The toolbar will be here</div>
<br /><br />
<?php
if (!isset($_GET['pg'])) {
$target = "empty.html";
} else {
$target = $_GET['pg'];
}
?>
<center>
<iframe src="<?php print $target; ?>" name="content" frameborder="0" width="100%" height="80%">
</iframe>
</center>
</body>
</html>
arunas_t
2010-05-20 14:10:25