Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I have the following PHP code:
<?php
$obrazek = the_post_thumbnail( 'product_page_image' );
list($nic,$nic,$nic,$nic,$nic,$obrazeklink,$nic,$nic,$nic,$nic,$nic) = explode('"', $obrazek);
?>
and $obrazek variable contains
<img width="1560" height="1170" src="http://takopix.com/wp-content/uploads/edd/2015/06/Melbourne-storm-1560x1170.jpg" class="attachment-product_page_image wp-post-image" alt="Melbourne storm">
but the HTML gets recognized even without echo... and explode doesn't work!
The function the_post_thumbnail is used to print the thumbnail markup. It returns nothing. You want get_the_post_thumbnail
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
In PHP, i have strings , similar:
"www.mysite.com/fa/doc/report/67571/مطذح کردنو تت";
"www.mysite.com/fa/571/نهتال اهخع";
"www.mysite.com/fa/";
I want if there are Persian's Chars of string, delete them.
Output:
www.mysite.com/fa/doc/report/67571/
www.mysite.com/fa/571/
www.mysite.com/fa/
How can i do this?
You should try this code.
<?php
echo remove_persian("www.mysite.com/fa/doc/report/67571/مطذح کردنو تت");
function remove_persian($text)
{
return preg_replace('#[^a-zA-Z0-9./]#', '', $text);
}
This will output like this:
www.mysite.com/fa/doc/report/67571/
You can use a regex :
$clean = preg_replace('[^a-zA-Z\/\d\s:]', '', $url);
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I wrote a program that uses an ISBN to query Amazon for that ISBN's price, and returns the following result:
5cb66919-8a8d-4c13-9175-790f0476508d0.0401580000000000TrueISBN9780340979266OffersAllAll0340979267809USD$8.09688USD$6.88598USD$5.98241010000
I need to format this so that I have the price information in a format that would be understandable to a human.
How can I do this?
Use this way..
<?php
$s = '5cb66919-8a8d-4c13-9175-790f0476508d0.0401580000000000TrueISBN9780340979266OffersAllAll0340979267809USD$8.09688USD$6.88598USD$5.982410100000';
$p = explode('USD',$s);
echo "<pre>";
print_r($p);
echo "</pre>";
?>
function returnPrice($response){
$prices = explode('USD',$response);
unset($prices[0]);
return $prices;
}
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have a host of files that generate link like this for hosted files:
http://endertec.com.br/hf/see-img.php?img=http://www.endertec.com.br/hf/do.php?imgf=Fav2.png
But when I see link like this on Facebook, it looks like this:
http://endertec.com.br/hf/see-img.php?img=http%3A%2F%2Fwww.endertec.com.br%2Fhf%2Fdo.php%3Fimgf%3Fav2.png
So I researched ways to convert it, and got the following code:
<?php
$str = 'http://www.endertec.com.br'.$_SERVER['REQUEST_URI'];
$src = str_replace('see-img.php?img=' , '' ,stristr($str , 'see-img.php?img='));
string rawurldecode ( string $src )
echo '<img src="'.$src.'"/>';
?>
But for some reason it does not work, does anyone know how it might work?
You need to store your rawurldecode in something.. try something like this:
$decoded_src = rawurldecode($src);
echo '<img src="'.$decoded_src.'" />';
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I put in the tag and inside it is this:
$one = "\Images\";
I correctly closed the tag itself, but everything after it is being considered part of the tag.
Full code:
<div id="skyscraper-ad">
<?php
$one = "\Images\";
?>
</div>
In PHP the \ character is used to escape an immediately following character that could be interpreted as 'not part of the string'.
eg. If you were to run this:
echo '\'hello';
it would output: 'hello.
In your code, you're escaping the ending ' which will make PHP throw an error.
echo '\Images\\'; on the other hand will output \Images\
You need to escape the backslashes:
<div id="skyscraper-ad">
<?php
$one = "\\Images\\";
?>
</div>
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
$out_terms[$term->name] = '' . $text . '';
Please help me check where the code gone wrong,any missing notes etc,as I am really 0 into php
$out_terms[$term->name] = sprintf('%s', $term_link, $text);
Try this (best construct) :
$out_terms[$term->name] = "$text";
or :
$out_terms[$term->name] = ''.$text.'';