Assign button image to links from db - php

php newbie. echoing out links to product pages, the following code works fine:
<a href="<?php echo $rows[$product_buy];?>"<p>Click Here for Details</p></a>
but, would like to change text link "Click Here..." to an image of a button.
tried different ways, searched around, still haven't figured it out

You could simply style your link to look like a button (by giving it a class/id to make sure not all links are targeted) or you can put an img tag between the a tag.
<img src="path_to_img" alt="">

Related

PHP Snipped not rendering in iframe

I'm trying to open the user_url within an iframe on a private user page in Wordpress.
I put the following code into a snippet:
<?php echo get_the_author_meta('user_url',$userID); ?>
When I use the short code on the user page it does display the user URL, I can also use it in an hyperlink like this:
link text
But when I put the short code into an Iframe the short code does not change into the URL anymore.
<iframe src="[cmruncode name='dash']" height="300" width="300" title="Iframe"></iframe>
Does anyone knows why this is not working and know a solution?
Thanks Peter
If you are using WordPress shortcode then you have to call shotcode using function do_shortcode.
You can try this one
<iframe src="<?php echo do_shortcode( '[cmruncode name="dash"]' ); ?>" height="300" width="300" title="Iframe"></iframe>
And I'm not sure why anchort text display right output. That's weird.
Anyway if you used do_shortcode to output your shortcode then it will work every place.
This only works when I put it directly into the template, in that case no snippet-shortcode is needed at all. But the content needs to be hidden when the user is logged-out.
Normally the plugin "client portal" that I use should take care of this
but it has a content block that does not support PHP and also does not render the php snippet that I made.
Any suggestions?
The solution was to put the iframe code completely into a snippet.
Like this:
<iframe src="<?php echo the_author_meta('user_url',$userID); ?>" height="2400" width="100%" title="Iframe"></iframe>

joomla:how to show a image popup to enter into website

I want to show a click-able image popup on my home page of my website.
when user clicks on that image further they can view the website.
Use anchor text around it...
<a href="<URL TO WHERE YOU WANT TO GO>" ><img src="<PATH TO IMAGE>" /></a>
The simplest solution is probably to use a third party extension like SplashR or similar:
http://extensions.joomla.org/extensions/style-a-design/popups-a-iframes/11693

Open a fancybox gallery from another HTML file

I have two files, one with HTML code when I've diferent photo albums links, example:
<a href="albumprueba.php"><img class="fancyboxi"
src="Libro Fez/Libro Fez - 001.jpg" alt="image19"
width="91%" height="56" /></a>
And another file (is php) I've a routine that scans all the photos in a folder, and shows photos:
<a class="fancyboxi" data-fancybox-group="gallery" title="Laurea"
href="Libro Fez/<?php echo $archivos[$imagen_a_empezar]?>"><img
src="Libro Fez/<?php echo $archivos[$imagen_a_empezar]?>" alt="" width="19%"/></a>
I would like to open the HTML file from an album and open a fancybox with all the photos that showing the routine in PHP file.
I've tried to do in the HTML file this, but doesn't works:
<img src="Libro Fez/Libro Fez - 001.jpg" alt="image19" width="91%" height="56" />
Any idea? thank.
Your href is certainly malformed.
albumprueba.php?Libro Fez/Libro Fez - 001.jpg
That isn't an address as URLs cannot have spaces (go to it manually and check what the address is in the navigation bar in your browser). Moreover it's just landing on a jpeg - are you sure you want this link to be to a single image?
Other than that the anchor should work. Are you getting a 404 error after following the link? If you want the other html file to be perptually viewable from the parent page you should consider using an iframe.

Open image via url on another page inside a div with php

I have a link that recieves a dyanamic image via php, and when you click it, it opens the image in a new window. It looks like this:
Click Here
I want to open the image on a page called red.php, and inside a div with the id=green.
From the sending page I'm thinking of something like this:
Click Here
On red.php the code would possibly be something like this:
<?php
$picture = $_GET['IMAGE_FULL_URL'];
echo ".$picture"
?>
I'm sure I have something wrong above, and I don't know where to begin to add the div id to the url, or if I can simply place the php code inside the div. Can someone please show me the code so this will work? Thanks.
here is an example:
your initial HTML:
Click Here
your Red.php:
<div id="green">
<img src="<?php echo urldecode($_GET['pic']); ?>" alt="" />
</div>

How to make a onmouseover work in mysql catalog

I'm having difficulty creating a button on my catalog page, the catalog page returns either 8 15 or 20 products from a mysql database so i use a loop to pull each product out of the database, and i need a addtocart button which uses javascript to create an onmouseover effect the code is as follows
echo "<a href=\"catalog.php?buyproduct=$productNumber\" onmouseover=\"document.crt.src='images/addcrt_btn_dn.png'\"
onmouseout=\"document.crt.src='images/addcrt_btn.png'\">
<img src=\"images/addcrt_btn.png\" name=\"crt\" alt=\"Add to cart\" width=\"81\" height=\"24\"> </a>";
it displays the image properly but nothing happens when the mouse is put over the image. I'm guessing that this could be caused because since either 8 15 or 20 of these images are being created, the "name=crt" is throwing the whole thing off, if so how could i fix this?
Any advice would be helpful thank you!
Instead of using the name attribute on the <img>, I would start by recommending you use the id attribute, as follows:
<img id="crt" />
Then you can change the src as follows:
document.getElementById('crt').src = 'images/addcrt_btn_dn.png';
Make sure you properly escape all those quotes properly, or work on generating the content another way (here's an example sticking with the name attribute):
...
?>
<a href="catalog.php?buyproduct=<?php=$productNumber?>" onmouseover="document[crt].src='images/addcrt_btn_dn.png'" onmouseout="document[crt].src='images/addcrt_btn.png'">
<img src="images/addcrt_btn.png" name="crt" alt="Add to cart" width="81" height="24">
</a>
<?php
...

Categories