i have a question.
I have this code to get an profile name as an link.
<a href=<?php echo $userpro->permalink( get_the_author_meta('ID') );
?>><?php echo $user_id=get_the_author_meta('display_name');?></a>
The link isnt clickable. I am a newbie in coding.
So maybe somebody can help me :)
Greetings
Try this:
<a href="<?php echo $userpro->permalink(get_the_author_meta('ID')); ?>">
<?php echo get_the_author_meta('display_name'); ?>
</a>
If it doesnt work... please supply the value and initialisation of $userpro!
Related
I am trying to see if a file in my database exists, and if it does, show that file as a hyperlinked button. The file is a URL. I am able to get the file to show accordingly, but the button shows even if there is no hyperlink. I have been researching everywhere to find out how I can echo the button only if there is a corresponding file but have had no luck. Just can get it right. Here is what I have and appreciate the help.
<?php if (file_exists($video))?><a class="videobutton" href="<?php echo $video; ?>"></a>
So based on Your Comment that you want to hide the whole button if the file is not found so this is how to do it :
<?php
if (file_exists($video)): ?>
<a class="videobutton" href="<?php echo $video; ?>"></a>
<?php endif; ?>
OR
if (file_exists($video)){ ?>
<a class="videobutton" href="<?php echo $video; ?>"></a>
<?php } ?>
<?php if (file_exists($video)){?>
<a class="videobutton" href="<?php echo $video; ?>"></a>
<?php }
else {
///
} ?>
In my opinion you missed the "{" brackets within the if statement.
Im trying to use the following code:
<a class="brand" href="<?php echo site_url('admin/dashboard'); ?>"><?php echo $meta_title; ?></a>
It loads an empty navbar but wont load anything under and there are no links.
cheers.
I didn't understand your question. Give more details.
What is the result of the following?
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
echo site_url('admin/dashboard');
echo $meta_title;
?>
The link page:
<a href="displayProduct.php?productID=<?php'.$pID.'?>">
The displayProduct.php page:
<?php
echo $_GET["productID"];
?>
This is my tester, to see if clicking on the link will pass the data from page 1 to displayProduct page.
It successfully passes the variable in the ' URL ' bar but the echo does not display that variable.
Am I missing something?
You missed an echo and have some weird concatenation.
<a href="displayProduct.php?productID=<?php'.$pID.'?>">
should be:
<a href="displayProduct.php?productID=<?php echo $pID; ?>">
<a href="<?php echo 'displayProduct.php?productID=' . $pID; ?>">
The shortest way:
<a href="displayProduct.php?productID=<?php echo $pID ?>">
<?php $picNumberSlide = "<div id='slidenumber'></div>" ;?>
Num Print
<div id="slidenumber"></div> -> (Picture slide number)
Link
<a href="share?picNum=<?php echo $picNumberSlide;?>">
Not work.
<div id='slidenumber'></div> slide number of the screen writes.
I intended to write inside the URL's
How i can do? Thank you!
(i sorry for Eng)
<?php $picNumberSlide = "<div id='slidenumber'></div>" ;?>
The above defines the $picNumberSlide variable as a div.
<a href="share?picNum=<?php echo $picNumberSlide;">
Here you are placing a div inside the href of an anchor, that will never work.
You need to assign the $picNumberSlide variable only the number you wish to use.
Then using
<a href="share?picNum=<?php echo $picNumberSlide; ?>">
will work.
$picNumberSlide should only = a number
Change <a href="share?picNum=<?php echo $picNumberSlide;">
To <a href="share?picNum=<?php echo $picNumberSlide;?>">
(You were missing the closing tag for php)
I have these bits here that will display a google map link for me. How can I wrap this in some sort of if statemnt that will check to see if there is ANY data in $event['where']. I don't want the link to display when there is no data.
<a title="See on Map" target="_blank" href="http://maps.google.com/maps?q=<?php echo $event['where']; ?>">See on map</a>
<?php if(!empty($event)){ ?> <a title="See on Map" target="_blank" href="http://maps.google.com/maps?q=<?php echo $event['where']; ?>">See on map</a> <?php } ?>
Try this:
<?php echo (!empty($event['where'])) ? $event['where'] : ""; ?>
Well isset() will determine if a variable/object is set and is not null
if(isset($event['where'])){
//...
}
http://php.net/manual/en/function.isset.php
The following will not show the link if $event['where'] is not set, is null, is blank (""), is false or is 0 - I think it is what you want:
<?php
if (!empty($event['where'])) {
?>
<a title="See on Map" target="_blank" href="http://maps.google.com/maps?q=<?php echo $event['where']; ?>">See on map</a>
<?php
}
?>