Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I know it may sound stupid, but im trying to echo an image that i get his name from the url, i dont get anything only the alt text of the image.
This is my code
<?php
$url = $_GET["userpic"];
$DisplayImg = "./Imagenes/".$url.".jpg";
?>
<html>
<body>
<img src="<?php echo $DisplayImg; ?>" alt="Error" width="100%" height="100%" border="0" />
</body>
</html>
Dante,
Change the extension to .php instead of .html
If you want to run a php code into a .html refer to How do I add PHP code/file to HTML(.html) files?
Try this:
<html>
<body>
<img src="../Imagenes/<?php echo $_GET["userpic"]; ?>.jpg" alt="Error" width="100%" height="100%" border="0" />
</body>
</html>
If that still dont work then your path is wrong you can see it by adding
<?php echo "<a href='../Imagenes/".$_GET["userpic"].".jpg'>this should link to your image</a>"; ?>
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
I have a php code which echos a html element:
<?php echo the_content(); ?>
It's resulting in:
<p>MY CUSTOM TEXT FROM ANOTHER PAGE INSIDE MY SITE</p>
How can I remove the <p> & </p> from the result?
I don't want to manually remove the tags <p> & </p> from the page it's coming from, because it is also used in another page in html.
*Edited
I'm currently trying this: *But it's not working...
$content = the_content();
echo strip_tags($content);
and
$content = the_content();
$content = strip_tags($content);
echo ($content);
You could use strip_tags():
<?php echo strip_tags(the_content()); ?>
Also:
<?= strip_tags(the_content()) ?>
I did it to work with this:
<?php echo substr(strip_tags($post->post_content), 0, 160) . '...'; ?>
Probably I was using the element the_content() from wordpress which includes automatically an HTML element <p> & </p> for the front-end page, with post_content it gets the inner content from the post without the f*cking <p> & </p>
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
Using advanced custom fields plugin on my wordpress site. I have a select option in one of the custom post types which determines if post going to be a link to another page or call out popup.
Here is how it looks.
<!-- here goes a code defining post type. Works fine -->
<?php $hmltype = get_field('post_url_or_popup'); ?>
<div class="tablecell midlineunit middle">
<a class="table midunithref mw1" <?php if ($hmltype == hml_url) { echo 'href="<?php the_field('hplb_url'); ?>" ' } endif; ?> >
</a>
</div>
Must be a syntax error, but I'm just starting out with php, so, kind of difficult to find the mistake.
What is hml_url? Is it a variable called $hml_url..? Back to your issues, you're using endif; here completely wrong. You can only ever call it if you instantiate it like this:
if(condition) :
do stuff;
endif;
Now to fix your print.
<a class="table midunithref mw1" <?php echo ($hmltype == hml_url) ? 'href="'. the_field('hplb_url'); .'"' : ''; ?> >
You'll need to figure out/tell us what hml_url is for us to solve your issue. You would've also seen the error if you turned your error reporting on. You can do this by adding this to the top of your script:
ini_set('display_errors', 1);
error_reporting(-1); // or you could do E_ALL
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
i'm trying to add a QR to each of my sites with this code..
<img alt="QR code" src="http://chart.apis.google.com/chart?cht=qr&chs=150x150&chld=L|4&chl=<?php the_permalink(); ?>" width="150" height="150" />
but when i use a QR read on the code that it generate i only getting this
<?php the_permalink(); ?>
on the screen
someone how can help ?
PHP can't process the code since it's encoded.
Try:
<img alt="QR code" src="http://chart.apis.google.com/chart?cht=qr&chs=150x150&chld=L|4&chl=<?php echo urlencode(get_permalink()); ?>" width="150" height="150" />
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
Friends,on the index page there is image for each tittle but these are not show.
this is web site : www.manisaihtiyac.com
I think there is a problem right this code :
<div class="yef_resim">
<a href="<?php the_permalink(); ?>">
<img src="<?php echo get_post_meta($post->ID, 'logo', true); ?>" border="0" />
</a>
</div>
Nothing is being returned by your function get_post_meta:
<a href="http://www.manisaihtiyac.com/?p=35">
<img src="" border="0">
...
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
So I'm building a website and I'm attempting to reuse code for a scrolling photo banner.
I can mock-up everything pretty well within a strict html page. So I decided to move everything over to PHP to help make things more efficient and with the intent of eventually using MySQL in other content on the site. However, after I created my functions and began to plug everything in the photo banner disappeared. Everything else including the CSS displays beautifully. I went so far as to remove the CSS from the page to see if that was the problem. Unfortunately the images still refuse to show up. It was a direct copy->paste from the working HTML document so I'm not totally sure why the photos for the banner aren't appearing. Any advice or help would be great. Here's the code:
<html>
<style>
#import "honeysstyle.css";
</style>
<div id="container">
<div class="photobanner">
<img class="first" src="C:\wamp\www\Honeys Project\honeys\Image1.jpg" alt="">
<img src="C:\wamp\www\Honeys Project\honeys\Image2.jpg" alt="">
<img src="C:\wamp\www\Honeys Project\honeys\Image3.jpg" alt="">
<img src="C:\wamp\www\Honeys Project\honeys\Image4.jpg" alt="">
<img src="C:\wamp\www\Honeys Project\honeys\Image5.jpg" alt="">
<img src="C:\wamp\www\Honeys Project\honeys\Image1.jpg" alt="">
<img src="C:\wamp\www\Honeys Project\honeys\Image2.jpg" alt="">
<img src="C:\wamp\www\Honeys Project\honeys\Image3.jpg" alt="">
<img src="C:\wamp\www\Honeys Project\honeys\Image4.jpg" alt="">
</div>
</div>
<?php
require( 'function.php' );
draw_titlebar();
draw_navigation();
?>
</html>
image path should be like this
<img src="http://localhost/Honeys Project/honeys/Image2.jpg" alt="">
change
<img class="first" src="C:\wamp\www\Honeys Project\honeys\Image1.jpg" alt="">
to
<img class="first" src="honeys/Image1.jpg" alt="">