Why doesn't open my link? - php

I have that code for two tabs
<li>
<a href="#gallery_place" role="tab" data-toggle="tab">
<i class="fa fa-picture-o"></i>
<?php _e("Gallery", ET_DOMAIN); ?>
</a>
</li>
<li>
<a href="http://romanianusa.com/post-place?id=<?php the_ID(); ?>">
<i class="fa fa-history"></i>
<?php _e("Repost", ET_DOMAIN); ?>
</a>
</li>
Why of the second <li> does not open, Chrome display my link in bottom but when i click doesn't open the page. What is wrong?

If the function the_ID() returns the ID, you need to use echo to get the ID into the URL:
<a href="http://romanianusa.com/post-place?id=<?php echo the_ID(); ?>">

I resolved with that function:
<script>
function openWindow()
{
window.open('http://romanianusa.com/post-place?id=<?php the_ID(); ?>');
}
</script>
And in my <li>
<i class="fa fa-history" onclick="openWindow()"></i><?php _e("Repost", ET_DOMAIN); ?>
Thanks a lot #Barmar

Related

I Have Database Errors on my Codeigniter script

i install a school management system and one time login but after logout and enter username and password show a box with this message:
A Database Error Occurred , You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE _id IS NULL' at line 2 . SELECT * WHERE _id IS NULL . Filename: views/backend/header.php . Line Number: 34 "
header.php code :
<div class="row">
<div class="col-md-12 col-sm-12 clearfix" style="text-align:center;">
<h2 style="font-weight:200; margin:0px;"><?php echo $system_name;?></h2>
</div>
<!-- Raw Links -->
<div class="col-md-12 col-sm-12 clearfix ">
<ul class="list-inline links-list pull-left">
<!-- Language Selector -->
<div id="session_static">
<li>
<h4>
<a href="#" style="color: #696969;"
<?php if($account_type == 'admin'):?>
onclick="get_session_changer()"
<?php endif;?>>
<?php echo get_phrase('running_session');?> : <?php echo $running_year.' ';?><i class="entypo-down-dir"></i>
</a>
</h4>
</li>
</div>
</ul>
<ul class="list-inline links-list pull-right">
<li class="dropdown language-selector">
<a href="<?php echo site_url('home');?>" target="_blank">
<i class="entypo-globe"></i> Website
</a>
<a href="#" class="dropdown-toggle" data-toggle="dropdown" data-close-others="true">
<i class="entypo-user"></i>
<?php
$name = $this->db->get_where($this->session->userdata('login_type'), array($this->session->userdata('login_type').'_id' => $this->session->userdata('login_user_id')))->row()->name;
echo $name;
?>
</a>
<?php if ($account_type != 'parent'):?>
<ul class="dropdown-menu <?php if ($text_align == 'right-to-left') echo 'pull-right'; else echo 'pull-left';?>">
<li>
<a href="<?php echo site_url($account_type . '/manage_profile');?>">
<i class="entypo-info"></i>
<span><?php echo get_phrase('edit_profile');?></span>
</a>
</li>
<li>
<a href="<?php echo site_url($account_type . '/manage_profile');?>">
<i class="entypo-key"></i>
<span><?php echo get_phrase('change_password');?></span>
</a>
</li>
</ul>
<?php endif;?>
<?php if ($account_type == 'parent'):?>
<ul class="dropdown-menu <?php if ($text_align == 'right-to-left') echo 'pull-right'; else echo 'pull-left';?>">
<li>
<a href="<?php echo site_url('parents/manage_profile');?>">
<i class="entypo-info"></i>
<span><?php echo get_phrase('edit_profile');?></span>
</a>
</li>
<li>
<a href="<?php echo site_url('parents/manage_profile');?>">
<i class="entypo-key"></i>
<span><?php echo get_phrase('change_password');?></span>
</a>
</li>
</ul>
<?php endif;?>
</li>
<li>
<a href="<?php echo site_url('login/logout');?>">
<?php echo get_phrase('log_out'); ?><i class="entypo-logout right"></i>
</a>
</li>
</ul>
</div>
</div>
<hr style="margin-top:0px;" />
<script type="text/javascript">
function get_session_changer()
{
$.ajax({
url: '<?php echo site_url('admin/get_session_changer');?>',
success: function(response)
{
jQuery('#session_static').html(response);
}
});
}
</script>
line 34 :
$name = $this->db->get_where($this->session->userdata('login_type'), array($this->session->userdata('login_type').'_id' => $this->session->userdata('login_user_id')))->row()->name;
I am beginner . please help me step by step

Why is my p element in single.php not being implemented?

I work for this organization, Vibro, and I am website responsible. We have a sharing box with social icons on everyone of our articles. We want to add the text "del:" (Meaning share in norwegian) in front of the icons in the box. When I went into single.php and added a paragraph element with the text, the code won't be implemented.
Do you have any idea why, and how to fix it?
I've already tried: corrected syntax error, deleted cache and minified css, tried indenting with space and put the p element outside the ul. Does not work! Maybe the changes takes some time to be implemented, I made some changes earlier today that didn't go through before later.
Here's the code in single.php:
<div class="box-social">
<ul class="social social</ul>
<p>Del:</p>
<li>
<a class="circle-icon" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=<?php the_permalink(); ?>"><i class="fa fa-facebook" aria-hidden="true"></i>
</a>
</li>
<li>
<a class="circle-icon" target="_blank" href="https://www.linkedin.com/shareArticle?mini=true&url=<?php the_permalink(); ?>&title=<?php the_title(); ?>&summary=&source="><i class="fa fa-linkedin" aria-hidden="true"></i>
</a>
</li>
<li>
<a class="circle-icon" target="_blank" href="https://twitter.com/home?status=<?php the_permalink(); ?>"><i class="fa fa-twitter" aria-hidden="true">
</i>
</a>
</li>
</ul>
</div>
The code you provided has invalid markup.
You can use something like this https://validator.w3.org/#validate_by_input to validate your html.
One issue with your code is Element p not allowed as child of element ul in this context.
I fixed the broken <ul> and moved the <p> before it.
<div class="box-social">
<p>Del:</p>
<ul class="social social">
<li>
<a class="circle-icon" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=<?php the_permalink(); ?>"><i class="fa fa-facebook" aria-hidden="true"></i>
</a>
</li>
<li>
<a class="circle-icon" target="_blank" href="https://www.linkedin.com/shareArticle?mini=true&url=<?php the_permalink(); ?>&title=<?php the_title(); ?>&summary=&source="><i class="fa fa-linkedin" aria-hidden="true"></i>
</a>
</li>
<li>
<a class="circle-icon" target="_blank" href="https://twitter.com/home?status=<?php the_permalink(); ?>"><i class="fa fa-twitter" aria-hidden="true"></i>
</a>
</li>
</ul>
</div>

Show active navigation for current page

i'm having some problems with my html, php code. With this code, my nav will show the active li but the other pages which are not active won't have style or links.
<!--/. PHP "active" -->
<?php
$current_url = basename($_SERVER['PHP_SELF']);
$active = "class=\"active-menu\"";
?>
<!--/. PHP "active" -->
<nav class="navbar-default navbar-side" role="navigation">
<div class="sidebar-collapse">
<ul class="nav" id="main-menu">
<li>
<?php if ($current_url == "home.php") { ?>
<a <?php echo $active;?> href="home.php"><?php } ?><i class="fa fa-dashboard"></i> Dashboard</a>
</li>
<li>
<?php if ($current_url == "new.php") { ?>
<a <?php echo $active;?> href="new.php"><?php } ?><i class="fa fa-qrcode"></i> Nieuw item toevoegen</a>
</li>
<li>
<?php if ($current_url == "show.php") { ?>
<a <?php echo $active;?> href="show.php"><?php } ?><i class="fa fa-qrcode"></i> Bekijk inventaris</a>
</li>
<li>
<?php if ($current_url == "profile.php") { ?>
<a <?php echo $active;?> href="profile.php"><?php } ?><i class="fa fa-user"></i> Gebruikersprofiel</a>
</li>
<li>
<i class="fa fa-sitemap"></i> Gebruikers<span class="fa arrow"></span>
<ul class="nav nav-second-level">
<li>
Beheerders
</li>
<li>
ICT - Verantwoordelijken
</li>
<li>
Raadplegers
</li>
</ul>
</li>
<li>
<?php if ($current_url == "empty.php") { ?>
<a <?php echo $active;?> href="empty.php"><?php } ?><i class="fa fa-fw fa-file"></i> Lege pagina</a>
</li>
</ul>
</div>
</nav>
the pages with no styling will also not have a link. The active-menu class has the styling.
Your if condition it is wrong.
Try something like this in every <li>.
<li>
<a <?php echo $current_url == "home.php" ? $active : ''; ?> href="home.php"><i class="fa fa-dashboard"></i> Dashboard</a>
</li>
<li>
<a href="new.php" <?php if ($current_url == "new.php") {echo $active;}?>>
<i class="fa fa-qrcode"></i> Nieuw item toevoegen
</a>
</li>
Put your list like this
You should make another class, like $not_active = "class=\"not-active-menu\"";
And add that to your code
<li>
<a href="something.php" <?php if ($current_url == "something.php") {echo $active;} else { echo $not_active; }?>>
<i class="fa fa-qrcode"></i> something
</a>
</li>

wordpress custom theme using php

I need a help in WordPress custom theme using PHP development, I was created language dropdown with images and in configure with Gtranslator Plugin, it`s work properly but when I select other language flag can't change in Dropdown.
my Code is given below:
<li class="dropdown">
<a href="JavaScript:void(0)" class="dropdown-toggle" data-toggle="dropdown"><img class="lang_icon" src="<?php echo get_stylesheet_directory_uri();?>/images/usaicon.png">
<i class="fa fa-angle-down" aria-hidden="true"></i>
</a>
<ul class="dropdown-menu dropdown_language">
<li><a onclick="doGTranslate('en|en')" href="JavaScript:void(0)">
<img class="lang_icon" src="<?php echo get_stylesheet_directory_uri();?>/images/usaicon.png">
</a>
</li>
<li id="cn"><a onclick="doGTranslate('en|zh-CN')" href="JavaScript:void(0)">
<img class="lang_icon" src="<?php echo get_stylesheet_directory_uri();?>/images/chinaicon.png">
</a>
</li>
<li><a onclick="doGTranslate('en|es')" href="JavaScript:void(0)">
<img class="lang_icon" src="<?php echo get_stylesheet_directory_uri();?>/images/mexiconicon.png">
</a>
</li>
</ul>
</li>

Links are not fully working after adding active class with php

I'm using php to add active link state to my navigation menu which is shared dynamically across all my website pages. But when I go to other links from homepage it works fine but when I go back to homepage its give me "object not found" error.
<!--start vertical menu-->
<?php
$index="menu-items";
$top_albums_default="menu-items";
$Topartists="menu-items";
$Toplists="menu-items";
$Charts="menu-items";
$menuLinkid=basename($_SERVER['PHP_SELF'],".php");
if($menuLinkid=="index"){
$index='active';
}else if ($menuLinkid=="top_albums_default"){
$top_albums_default='active';
}else if ($menuLinkid=="Topartists"){
$Topartists='active';
}else if ($menuLinkid=="Toplists"){
$Toplists='active';
}else if ($menuLinkid=="Charts"){
$Charts='active';
}
?>
<div id="vertical-menu">
<!--<h2 class="logo">LOGO</h2>-->
<img class="logo" src="../Graphics/icons/logo.png" alt="LOGO"/>
<h6 class="logo-desc">Arcade Music Repository</h6>
<ul class="menu-items">
<li>
<a class="<?php echo $index; ?>" href="index.php" ><i class="arcd-archive" ></i></br>Browse</a>
</li>
<li>
<a class="<?php echo $top_albums_default; ?>" href="Top-albums/top_albums_default.php"><i class="arcd-music97"></i></br>Top albums</a>
</li>
<li>
<i class="arcd-microphone52"></i></br>Top artists
</li>
<li>
<i class="arcd-numbered8"></i></br>Top lists
</li>
<li>
<i class="arcd-rising9"></i></br>Charts
</li>
</ul>
</div>
<script type="text/javascript" src="../js/jquery-1.11.3.min.js"> </script>
Please check this in video
Here is my site folders structure
You are missing a forward slash on your homepage link.
Make it like this:
<ul class="menu-items">
<li>
<a class="<?php echo $index; ?>" href="/index.php" ><i class="arcd-archive" ></i></br>Browse</a>
</li>

Categories