Cake PHP Link Doesn't Display
I have string like "Venditoris: Beware of Scams » Blog Archive » Trilegiant Complaints ..." in Database but when I try to display it ,It is not displaying. So,I used html_entity_decode function but still it is not display.
I am Using cakePHP.below is my code to display that links.
echo $html->link(html_entity_decode(
$listing_end_arr[$i]['Listing']['listing_title'],ENT_QUOTES),
$listing_end_arr[$i]['Listing']['listing_url'],
array('target'=>'_blank', 'style'=>'color:'
. $colorArr[$listing_end_arr[$i][开发者_JAVA百科'Listing']['listing_sentiment']])) ;
Please Help me.
Check the CakePHP manual if you are using $html->link
correctly. If so, var_dump
the return value instead of echo
ing it. If it is empty, do
var_dump( $listing_end_arr[$i]['Listing'] );
to see what the Listing key contains. If the desired content is not in the dump, you know the error is elsewhere; probably in fetching the string from where it is stored.
Also, instead of using array[n][foo][bar][baz]
, consider assigning the subarray to a variable while looping over the array, e.g. $listing = array[n][foo][bar]
, so you can just do $listing[baz]
. This will dramatically increase readability of your code.
inspect generated html first.. your code should echo a link, maybe it's just not visible (styling, color..).
精彩评论