I'm using bootstrap for my popup window. The popup winodw works fine.
Here is the code
<?php if(......my if condition for popup.......){ ?>
<a data-target="#remoteModal" data-toggle="modal" href="popup.php?book_code=<?php echo $row['BookCode']; ?>&month=<?php echo $month; ?>">My PopUp Link</a>
<?php } ?>
When I use print preview using File >> PrintPreview, the link is printed in the preview section. i.e the link is viewable ( popup.php?book_code=1&month=Apr )
How can I eliminate this?
First time i face this problem.
The print preview is like this
S.No Book Name Book Code
1 ABC 20
(popup.php?book_code=1&month=Apr )
2 DEF 40
(popup.php?book_code=1&month=Apr )
Found the solution here in this page
https://drupal.stackexchange.com/questions/59900/how-to-get-rid-of-added-urls-when-printing-a-bootstrap-themed-page
May be this will be useful..
Just what i did is.. opened the bootstrap.css
Removed these lines from the css
a[href]:after {
content: " (" attr(href) ")";
}
This will surely help someone..
Thanks,
Kimz
Related
(first post ho yeah :) )
So,I have a very strange problem:
I have a <form> to edit some options for each users in a table.
So I use
while (blablabla req sql)
{
echo '<tr><td>['name']</td><td>['firstname']</td><td><button for modal appear></td></tr>';
echo 'my modal here';
}
(this is not the true code)
And... it work but it's look very very ugly (see image 1 when the form is out of the while and image 2 when I put the form into the while)
Any solution?
Code here >> http://paste.ideaslabs.com/show/Tn4cUpjjos
Code generated [only the end of one row] >> http://paste.ideaslabs.com/show/Df4gvrJoS
You have just messed up the HTML. Remember, PHP is just generating an HTML, that you did not do properly. Do something like:
while (blablabla req sql)
{
echo "<tr>";
echo '<td>['name']</td><td>['firstname']</td><td><button for modal appear>';
echo "</tr>";
echo 'my modal here';
}
More suggestions:
Inspect your generated HTML and try to figure out why wrong HTML was generated. Stop comparing UIs.
After one weekend of reflexion I'have finnaly find a way to solve this problem:
I put my modal in a exterior content (at the top of my php page) and in a new while, with the same request
2 same separate request like that
result3 = $bdd->query("SELECT * FROM TABLE_1");
result3 = $bdd->query("SELECT * FROM TABLE_1");
At the top of my .php page after <body>
<div header>
while ($ligne = $result3->fetch_assoc()){
echo '<form></form>';
}
</div>
And after, my table with:
while ($ligne = $result3->fetch_assoc()){
echo '<table></table>';
}
That's all !
Correct my english or ask me if you have a similar problem like that ;)
I have a page with a menu on for logged in users
i am including this page on all the other pages in my site but i don't want users that are NOT logged in to be able to click the links
How can I disable all the links on that page if a PHP variable = 'no'
i know i can use
if($php_var == 'no') {
//do something here
}
but I'm not sure how to disable the links?
Is there any way using CSS or Javascript to disable links?
try this
if($php_var == "no")
{
echo 'Your Text For Link';
}
else
{
echo 'Your Text For Link';
}
user javascript:void(0); for no redirection. this will maintain your css for link like others but when you click it won't redirect.
If i understood everything correctly, the answer is quite simple. Why dont you just replace the links with plain strings?
if($php_var === "no") {
echo "This is the text of your link.";
} else
{
echo "This is the text of your link.";
}
But as already mentioned, completely hiding the links is better, as usual users gets confused by such things.
this will remove all href from a tags. If php var is no. Put this code after all a tags else won't work
<?php
if($php_var === "no"){
echo '<script>var x=document.getElementsByTagName("a");for (i=0;i<x.length;i++){x[i].removeAttribute("href");}</script>';
}
?>
You would need to do the processing pre-output, PHP will not dynamically disable the href of an already created DOM element.
If you are producing the output of the links via PHP, you could do something like:
echo 'Link';
Otherwise, you could create an AJAX call to the PHP script, and if it returns 'no', iterate through your pages links and disable the links via JavaScript.
<a href='<?php echo ($php_var == "no") ? "javascript:void(0)" : "link.php" ?>'>
Hello user
</a>
you could do this:
// define if you want to make links work
$linking = true;
Then your link:
<a <?php if($linking == true) { ?> href="..." <?php } ?>>Link</a>
If links are not shown, I'd also add some CSS:
.link_that_is_no_link {
text-decoration: none;
cursor: default
}
How do you check if the user is logged in or not? Do you use sessions? The same way you check for the user if he is logged in you can decide to show items or not.
You can do both:
if(isset($_SESSION['id'])){
echo 'LINK';
}else{
echo 'LINK';
}
that will keep showing the link but will lead nowhere if the user is not logged in.
Or you can do :
if(isset($_SESSION['id'])){
echo 'LINK';
}else{
//do nothing here or put a link to the login page
}
that will show the link only if you are logged in.
I prefer the second option since I think that no users will like to see a link without being able to open it.
Note that code in this answer is just a guess of your real code
You can use PHP if-else condition and write HTML like this:
<a href="" onclick="return false;">
I have a page with two links (text link & banner link),
that should lead to the same redirect page
(on my domain).
The redirect would be to a link that shall include a variable,
that indicates which of the two link was clicked.
e.g.:
<?php
header("Location: http://external-domain.com/?ref=[value]");
die();
?>
wheareas the "value" should be "text" / "banner" or something similar.
How can I do this?
I'm not a web programmer at all so I don't have much technical knowledge,
I guess one possible solution (which I would rather avoid) would be to give a separate id for the text link and for the banner, e.g.:
text link:
http://mydomain.com/redirect.php?id=text
banner link:
http://mydomain.com/redirect.php?id=banner
whereas redirect.php would contain:
<?php
$source = $_GET['id']
?>
<?php
header("Location: http://external-domain.com/?ref=<?php print $source; ?>");
die();
?>
But that would mean that I have to use a different id for these internal links;
I would rather find a way to use the same exact internal links (maybe for example, have each link in a "div" or a "class" and get the div/class name somehow, and have them appear as the [value].
*EDIT:
Let me emphasize again: I'm looking for a way to do this without having to use any "?id=[something]" at the end of the text link or the banner link.
Thanks!
If you're already outputting the banner/text do this for the banner
<img src="imageHere.png">
And this for the text
text here
Then catch the id get values with
<?php
$id = $_GET['id'];
if ($id == 'banner'){
echo 'The clicked link was a banner';
}
else{
echo 'The clicked link was text';
}
<?php
$source = $_GET['id']
?>
<?php
header("Location: http://external-domain.com/?ref=<?php print $source; ?>");
die();
?>
should be
<?php
$source = $_GET['id'];
header("Location: http://external-domain.com/?ref=".$source);
die();
?>
Basic concatenation.
I'm using this script in php. I have successfully added the readmore option but i want any user that clicks on this link will then open up a new page with the full article and with gallery pictures. But i want it to open into the same window.
echo "<div id=message>";
$text = $row["message"];
<?php echo substr($text,0,500);?>
Read More »
please try the following:
echo "<div id=message>";
$text = $row["message"];
<?php echo substr($text,0,500);?>
Read More »
although _self is default value of the same so you need not write it.
Well lets try to explain am sorry about my english.
I have some xml files where I get the url from with some php scripts
everything goes right the only prob is i want to change the li BGcolor of the selected link like in css :active or giving only that link eg a class="current"
this below make dynamically the urls to the data
echo "<ul><li ><a href='?xml1=".$xmlGet."&link=".$link." '>".$slide->title."</a></li></ul><br/>";
with the above i get a list of links not only one like below as urls
http://localhost/html5/playerEnd/hoofdstuks.php?xml1=chapter_3733&link=1
http://localhost/html5/playerEnd/hoofdstuks.php?xml1=chapter_3733&link=2
http://localhost/html5/playerEnd/hoofdstuks.php?xml1=chapter_3733&link=3
etc etc
and it display as menu like this
link 1
link 2
link 3
link 4
etc etc
each link load a different data to my page when clicked so i want the one clicked to be active like an other color or something.
Use $_GET['link'] to find out which link has been clicked. Then add a class to the link which corresponds to this. You'll have to define the active class.
$linkID = $_GET['link'];
echo "<ul><li ><a href='?xml1=".$xmlGet."&link=".$link." '";
if ($linkID == $link) { echo " class=\"active\" "; }
echo ">".$slide->title."</a></li></ul><br/>";
And if you want the li to have the class (as asked in comments):
$linkID = $_GET['link'];
echo "<ul><li";
if ($linkID == $link) { echo " class=\"active\" "; }
echo "><a href='?xml1=".$xmlGet."&link=".$link."'>".$slide->title."</a></li></ul><br/>";