I have this php file which pulls from my datebase
<?php
$cdb = new PDO('mysql:dbname=xxx;host=localhost', 'xxx', 'xxx');
foreach ($cdb->query("SELECT * FROM images ORDER BY posted DESC LIMIT 3") AS $img)
{
$twofirst = substr($img['hash'], 0, 2);
echo '
<a style="position: relative; display: block; height: 140px;" href="/booru/post/view/' . $img['id'] . '" target="_blank">
<img src="booru/timthumb.php?src=images/' . $twofirst . '/' . $img['hash'] . '&h=125&w=125&q=100" width="125px" style="border-style: none"/>
</a>
';
}
Template
<div class="section">
<div class="secondaryContent">
<h3>New Cosplays</h3>
<iframe marginwidth="0" marginheight="0" width="125px" height="400px" scrolling="no" frameborder=0 src="image.php">
</iframe>
</div>
</div>
Is there a better way I can get this to work?
If I don't add the target="_blank" It just opens the page in the Iframe which is not what I want
Someone say to use AJAX but I have no idea of how to even start if someone could maybe show me an example that would be great.
Thanks for your time.
Use target="_top" instead of "_blank".
Related
I am trying to show image. I have an image named 5.png. And my database value $bnr_value also returns 5 correctly. but image does not show. How can I fix it?
<img src="new_img/header/career/"<?php echo $bnr_value.'png'; ?> alt="" class="image" style="max-width: 100%; ">
Try this:
<img src="new_img/header/career/<?php echo $bnr_value.'.png'; ?>" alt="" class="image" style="max-width: 100%; ">
//try this ..
<img src="new_img/header/career/<?php echo $bnr_value.'.png'; ?>" alt="" class="image" style="max-width: 100%; ">
=> "new_img/header/career/" is a not a full path ..
Example :- "new_img/header/career/<?php echo $bnr_value.'.png'; ?>" // set like this .
I Added below Google Analytics Event Tracking Code to download link
onClick="ga('send', 'event', 'Redirected2dl', 'QPRedirect');"
i Added the code directly to the php file as shown below . But when i tried to load the webpage the web page does not display!
<?php
$url = $_GET['url'];
echo
'<p style="text-align: center;"> Your QuestionPaper Will Be Diplayed Here.
<a id="downloadLink" href="http://www.questionspaper.in/wait.php?url='.urldecode($url).'" onClick="ga('send', 'event', 'Redirected2dl', 'QPRedirect');" >click here to Download Your QuestionPaper</a>
if (isset ($url))
{
echo
'<iframe ... src="http://docs.google.com/gview?url='.urldecode($url).'&embedded=true" height="800" width="900" ></iframe>';
}
else {
echo '<iframe ... src="
$url" height="1000" width="1000"></iframe>';
}
?>
Can Anyone Help me to rectify the problem.Thank you
The above Php File can Be veiwed here http://questionspaper.in/myiframe.php?url=
You need to escape the single quotes in the string you are echoing. You also want to urlencode the url parameter, not decode it.
<?php
$url = $_GET['url'];
echo '<p style="text-align: center;">Your Question Paper Will Be Diplayed Here.
<a id="downloadLink" href="http://www.questionspaper.in/wait.php?url='.urlencode($url).'" onClick="ga(\'send\', \'event\', \'Redirected2dl\', \'QPRedirect\');" >click here to Download Your QuestionPaper</a>';
if (isset ($url))
{
echo '<iframe ... src="http://docs.google.com/gview?url='.urldecode($url).'&embedded=true" height="800" width="900" ></iframe>';
} else {
echo '<iframe ... src=" $url" height="1000" width="1000"></iframe>';
}
?>
As <img src="path"> src attribute don't take the path from another driver,
so in php, image get converted to base_64 then image codes are given as path in image tag, it's working well but not in internet explorer? i am posting code here
$img = "D://images/1s.jpg";
$image = file_get_contents($img);
$image_codes = base64_encode($image);
$img1="D://images/1.jpg";
$image1 = file_get_contents($img1);
$image_codes1 = base64_encode($image1);
?>
<div style="float:left; width:900px; display:block;">
<h2>Back to pirobox homepage demo1</h2>
<div class="demo"><a href="data:image/jpg;charset=utf-8;base64,<?php echo $image_codes; ?>" class="pirobox_gall" title="Spain 2009" >
<img src="data:image/jpg;charset=utf-8;base64,<?php echo $image_codes; ?>" width="100" height="100" /></a></div>
</div>
<div style="float:left; width:90%; display:block; margin:5px 0 0 5px;">
</div>
</body>
I want to hide iframe if there is no $content present.
<div class="video">
<iframe width="600px" height="400px" src="'.$content.'?autoplay=1" frameborder="0" scrolling="no" allowfullscreen style="visibility:hidden;" onload="this.style.visibility=\'visible\';"></iframe>
</div>
In my case if $content is not present, iframe loads src="?autoplay=1"
I think this will do the trick:
<?php
// Test if variable is set and has content in it
if( isset($content) && $content != "") {
echo '<div class="video"><iframe width="600px" height="400px" src="'.$content.'?autoplay=1" frameborder="0" scrolling="no" allowfullscreen style="visibility:hidden;" onload="this.style.visibility=\'visible\';"></iframe></div>'
}
?>
This way the iframe will not be printed in the html in case of no content.
This is generated Twitter button, I added text inside.
> <iframe allowtransparency="true" frameborder="0" scrolling="no"
> src="http://platform.twitter.com/widgets/tweet_button.1357735024.html#_=1357817606773&count=horizontal&id=twitter-widget-0&lang=en&original_referer=&size=m&text=<?php
> echo $art["title"].'
> http://web.com/article.php?art_id='.$art["id"];?>&url=<?php
> echo
> 'http://web.com/article.php?art_id='.$art[id];?>&via=MyWeb"
> class="twitter-share-button twitter-count-horizontal" style="width:
> 107px; height: 20px;" title="Twitter Tweet Button"
> data-twttr-rendered="true"></iframe>
The problem is, that I cannot add a link into the tweet. When I add it there, there is not displayed even the simple text.
Has anyone similar issue or any help, how to fix it?
Thank you
I would reorganize your code a bit just to make the building of the iframe src easier to follow (there may be a mistake there). You should also make sure that the $art['title'] is urlencoded.
<?php
$iframe_src = 'http://platform.twitter.com/widgets/tweet_button.1357735024.html#_=1357817606773&count=horizontal&id=twitter-widget-0&lang=en&original_referer=&size=m&text=';
$iframe_src .= urlencode($art['title']);
$iframe_src .= 'http://web.com/article.php?art_id='.$art['id'];
$iframe_src .= '&url=http://web.com/article.php?art_id='.$art['id'].'&via=MyWeb';
?>
<iframe allowtransparency="true" frameborder="0" scrolling="no" src="<?php echo $iframe_src; ?>"
class="twitter-share-button twitter-count-horizontal"
style="width:107px; height: 20px;" title="Twitter Tweet Button"
data-twttr-rendered="true"></iframe>