Href with skype links is not displayed - php

I have the following code:
if (!empty($row['skype'])) {
echo "<b>Skype:</b> " . $row['skype'] . " Chat";
}
Unfortunately, this does not display as hyperlink on my website. If I change it to:
if (!empty($row['skype'])) {
echo "<b>Skype:</b> " . $row['skype'] . " Chat";
}
The link is displayed, but it is broken - it leads to www.domain.com/%22skype:venci?chat%22
I have other hrefs in my page like:
echo "<b>E-Mail:</b> " . $row['email'] . "<br />";
and these are displayed correctly, so I'm wondering.. Why is this not working?

I found the issue. It lies within the popover component in bootstrap. Thanks to all guys!
It looks like the popover does not support all href types :)

Related

Issue with AJAX and displaying multiple html tags

So I am using the code that I got off W3C here: http://www.w3schools.com/php/php_ajax_database.asp
modified it to fit with my file names and database etc, however I am having a weird issue with echoing my responses to look correct.
For every product that collects from the product database it needs to print it in a section tag like so:
while($row = $result->fetch_assoc())
{
echo "<section class='sideWays'>" . $row['product_ID'] . " " . $row['product_name'] . " " . $row['description'] . " " . "<div class='colHeaderImageRight'>" . '<img src="'.$row['image'].'"">' . "</div>" . "</section>";
}
However this code isn't working anymore, the closest I have gotten is it to only display one and then breaks the rest.
the PHP echo is being returned into the following div tag
<article>
<div id="txtHint"><b>Person info will be listed here...</b></div>
</article>
so I have tried changing my CSS to stuff like article > .txtHint > #sideWays or even just making the #sideWays css the same as .txtHint to skip the > #sideWays but nothing is working to display my CSS on the echo.
I'm not sure why but changing the keyword echo to print fixed the issue of it not recognising my html tags and applying the CSS to them.

Getting trouble in page redirection

I have the following screen in my project.Everthing is working fine other than the redirection link of View.As you can see it is poping up the validation error.I have no idea why its comming.Even,I am redirecting to diffrent model.
I want to go the diffrent page when clicking View.
I have the following code in my view.
//codes//
<div class="view" id="id">
<?php
echo "<h4>Name : " . $value['name']. "</h4>";
echo "<h4>Skills : " . $value['key_skills'] . "</h4>";
echo "<h4>Category : " . $value['title']. "</h4>";
echo "<h4>Experience : " . $value['experience'] . " Years.</h4>";
// echo CHtml::submitButton('View Details', array('name' => 'viewemployeedetails'));
echo CHtml::button('View',array(
'submit'=>array('SiteContoller/actionViewEmployeeDetails',array('id'=>$value['id'])),
));
?>
</div>
I have tried few things...but its not working.
You have to remove the 'Controller' text part and 'action' text part from:
'SiteContoller/actionViewEmployeeDetails'
and use
'site/viewEmployeeDetails'
if you want it to go to SiteController's actionViewEmployeeDetails action
You should use CHtml::link not CHtml::button unless you are posting data to the address. You can use css to style your link to look and visually behave like a button. In addition there is no submit attribute for button see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button

Same page Hyperlink with PHP

I would like to link to another part of a php page. So $x is a value I've pulled from an array that is a hyperlink.
echo "<a href='#{$x}'>{$x}</a>" . " ";
However I am stuck in linking to the target id on the same page.
echo '<a id="$x">' . '<h2>'.strtoupper(str_replace("_", " ",($x))).' ' . 'offers'.'</h2>'.'</a>';
Sure when I hover over the link, it is passing the correct value of $x in the query string, but not linking to the because I am coding the target id part wrong.
Any help appreciated.
Volterony
If you want to visit a ID on on the page use href="#id"
echo '' . '<h2>'.strtoupper(str_replace("_", " ",($x))).' ' . 'offers'.'</h2>'.'';
Improved Code
echo '<h2>'.strtoupper(str_replace("_", " ",($x))). 'offers </h2>';

Extract part of a link using php?

I am trying to grab the ID of my link from every single one and output it to a db which i will then use to go and scrape the actual page.
So i will grab the id, curl the page link then parse the details.
So far i have my links clickable, it's just trying to get the certain part of my links that is the hard part.
I have tried $_GET['id'] but this won't work as the id's are not in that format.
Here is the way my links are set out:
download.php/1000338/The%20Rise%20and%20Fall%20of%20Legs%20Diamond%20%5B1960%5D.avi.torrent
what i want to grab is the 1000338 part but i want it to do this for every single one and ofcourse they are not the same.
Any help is very much appreciated, thanks.
$link="download.php/1000338/The%20Rise%20and%20Fall%20of%20Legs%20Diamond%20%5B1960%5D.avi.torrent";
$x=explode('/',$link);
$id=$x[1];
demo:http://codepad.viper-7.com/cWYXKe
using your code:
$rss = simplexml_load_file('RSS FEED HERE');
echo '<h1>'. $rss->channel->title . '</h1>';
foreach ($rss->channel->item as $item) {
//echo the link echo '<h2>' . $item->title . "</h2>";
//echo the date echo "<p>" . $item->pubDate . "</p>";
//echo the description echo "<p>" . $item->description . "</p>"
$x=explode('/',$item->link);
$id=$x[1];
}
then use $id any way you like

php var value contains quotes

So... I have a mysql_fetch_array and I'm running into an issue when some of the mysql data contains single or double quotes. This is the dumbed down version of my code:
while($row=mysql_fetch_array($list)) {
echo "<tr>";
echo "<td onclick='edit_form(\"" . $row['item'] . "\");'>" . $row['item'];
echo "</td></tr>";
}
The edit_form() function is used to send the value of the current item back to the value of the input in the form so the user can then easily edit their entry and then sends an UPDATE command to mysql along with the proper primary key id (which I left out because of irrelevancy). The only issue I have is if a user puts single or double quotes into the form then it messes up the onclick attribute. Please help!! I am pretty new to php and can't figure this out. I've messed around with htmlentites() and html_entity_decode() but am still getting no where. Thank you so much!
Use htmlspecialchars on $row['item'] before inserting it in your document.
So your "dumbed-down" code should be:
while($row=mysql_fetch_array($list)) {
$item = htmlspecialchars($row['item']);
echo "<tr>";
echo "<td onclick='edit_form(\"" . $item . "\");'>" . $item;
echo "</td></tr>";
}
Try the below line instead of the original in your code and see if it works:
echo "<td onclick='edit_form(\"" . str_replace('"',"&quote;",$row['item']) . "\");\">" . $row['item'];
And where you would like to display the $item field, just replace it in reverse if you get &quote; instead of ' " '. For example:
$qoute_free= str_replace('&quote','"',$passed_value);
If you are using it in javascript, the function can be as below:
function edit_form(passed_value)
{
new_value=passed_value.replace(/&quote;/g,'"');
}
I advise using json_encode. That way you don't have to worry about special cases htmlspecialchars might miss (such as newlines).
while($row=mysql_fetch_array($list)) {
echo "<tr>";
echo "<td onclick='edit_form(" . json_encode($row['item'], JSON_HEX_APOS) . ");'>" . $row['item'];
echo "</td></tr>";
}
I'm just putting the values back into my <form> (when they click on a <td>) and when they hit SUBMIT it directs the data to a different .php file that uses a MySQL UPDATE instead of an INSERT. I finally found some code that works!
$list is a mysql_query I ran at the top of the document
$item is the title of one of my columns in MySQL
while($row=mysql_fetch_array($list)){
$item = json_encode($row['item']);
$item = str_replace("'","'",$item);
echo "<td onclick='edit_form(" . $item . ");'>" . $row['item'] . "</td>";
}
Now it display's correctly in the <form> when <td> is clicked (by jQuery input.val($item)) and it shows up in the table correctly via $row['item']. I don't really understand exactly how it's working (how the encode is making it work) but I am glad it is. Crazyness!!!! Thanks for responding! and thanks for your effort!!

Categories