i am having a career page with apply now button
<a class="btn-system btn-medium" href="apply/<?php echo $job->id;?> " style="box-shadow:none !important;">Apply Now</a>
now i have mwentioned the route for this anachor tag as
$route['apply/(:any)']='welcome/apply/$1' ;
Now when i click to my header navigation which has the following link :
<ul class="nav navbar-nav navbar-right">
<li>Home</li>
<li>About Us</li>
<li>Services</li>
<li>Portfolio</li>
<li>Blog</li>
<li>Career</li>
<li>Contact</li>
</ul>
It generates the link as base_url/apply/home thus not giving me the homepage or any other content
It is overlapping the link..Can neone help?
Prepend "link" with slash so it will be read from the root. Like
<a class="btn-system btn-medium" href="/apply/<?php echo $job->id;?> " style="box-shadow:none !important;">Apply Now</a>
I would put all of that in PHP with
<a class="btn-system btn-medium" href="<?php echo \"/apply/$job->id\";?> " style="box-shadow:none !important;">Apply Now</a>
Or as mentioned in comment by #RajJagani put it into base_url() function:
<a class="btn-system btn-medium" href="<?php echo base_url('apply/'.$job->id');?> " style="box-shadow:none !important;">Apply Now</a>
Related
<ul>
<li repeat.for="row of router.navigation" > ${row.title}
</li>
</ul>
infact i want to style one of the router button that generate with repeat.for method
want to make left border radius for navigation bar like the right of the navigation bar
As a one-liner option, you could bind your class attribute with ...
<li repeat.for="row of router.navigation" class="${myBool ? 'a-class' : 'another-class'}">${row.title}</li>
You can bind class with string interpolation or with .bind syntax. See https://aurelia.io/docs/binding/class-and-style#class
UPDATE: Sorry...should have read your other comment further down. If it's just for the first , why not just use CSS?
#myUl>li:first-child{
// my CSS here
}
You can identify the first repeated element with the $index context variable.
This would lead to something like this:
<ul>
<li repeat.for="row of router.navigation" >
<a if.bind="$index === 0" class="blah"> ${row.title} </a>
<a else class="another class"> ${row.title} </a>
</li>
</ul>
If you need to do the styling on the <li> tag, the solution could be like this:
<ul>
<template repeat.for="row of router.navigation" >
<li if.bind="$index === 0" class="blah"> ${row.title} </li>
<li else class="another class"> ${row.title} </li>
</template>
</ul>
I wanted to display navigation element as active (class nav-item active) when that element is clicked and the other elements with the non active class (nav-item). I am also using Thymeleaf layouts.
In the controller i have following code
#GetMapping("/login")
public String getLoginPage(Model model) {
model.addAttribute("activeLink", "Login");
return "login";
}
In the layout.html file (this file contains common header and footer for all pages), i have following code
<nav th:replace="navigation.html :: navibar(activeLink=${activeLink})"></nav>
In the navigation.html (this file only has navigation related code), i have code similar to
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top" th:fragment="navibar(activeLink)">
<a class="navbar-brand" href="/title">Title</a>
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
<ul class="navbar-nav mr-auto">
<li th:class="${#strings.equals(activeLink, 'Home')} ? 'nav-item active' : 'nav-item'"><a class="nav-link" href="/">Home<span class="sr-only">(current)</span></a></li>
<li th:class="${#strings.equals(activeLink, 'Register')} ? 'nav-item active' : 'nav-item'"><a class="nav-link" href="/register">Register</a></li>
<li th:class="${#strings.equals(activeLink, 'Login')} ? 'nav-item active' : 'nav-item'" sec:authorize="isAnonymous()"><a class="nav-link" th:href="#{/login}">Login <span class="sr-only">(current)</span></a></li>
<li class="nav-item active" sec:authorize="isAuthenticated()"><a class="nav-link" th:href="#{/logout}">Logout <span class="sr-only">(current)</span></a></li>
</ul>
</div>
In the template returned by the controller (login), I do not have any navigation links specific code.
The above code is working, but is there a better simpler way to active navigation items?
Also, if I use flash attributes
redirectAttributes.addFlashAttribute("activeLink", "Register");
in the controller, then the functionality doesn't work
To avoid adding the activeLink to the model you can pass the activeLink when you include the fragment.
Like:
<div th:replace="nagivation :: navibar('Login')"></div>
Btw. you can remove the .html after the layout name.
using code
<a href="<?php echo $this->getBaseUrl()."become-a-reseller.phtml"; ?>" class="level-top ui-corner-all" role="menuitem" >
<span><?php echo __("Become A Reseller")?></span>
</a>
in topmenu.phtml file . and i want to redirect this href to become-a-reseller.phtml file which is located at app/design/my_theme/dreamshop/magento_theme/templates/html folder then what should be the path in anchor tag href
I read here about Microdata in Joomla. However, I'm not able to produce a link with Microdata.
I want a Microdata output like:
<a itemprop="url" href="http://someurl">
<span itemprop="name">Some Url</span>
</a>
I want a link to an organisation from my client's website. My code is:
$microdata = new JMicrodata('Organization');
<div <?php echo $microdata->displayScope();?>>
echo $microdata->content( $this->item->url )->property( 'sameAs' )->display();
// outputs <span itemprop="sameAs">www.url_of_company.com</span>
</div>
Both url and sameAs Schema.org properties are of type URL, as per my understanding.
I also tried to wrap it with an anchor tag but Joomla is not producing itemprop along with href attribute in anchor tag.
I must be missing something.
Ok I analysed in libraries/joomla/microdata/microdata.php the method display();
and it doesn't exist any way to produce a <a href="#" > tag, only div, span and meta.
Btw there is a static method called htmlProperty(), with that you can add the property you need.
<?php $microdata = new JMicrodata('Organization'); ?>
<div <?php echo $microdata->displayScope(); ?> >
<a <?php echo JMicrodata::htmlProperty('url'); ?> href="http://google.com">
<?php echo $microdata->content('Google')->property('name')->display(); ?>
</a>
</div>
i'm in the middle of creating a website and i want to creat a dynamic dropdown menu.The problem is that when i load the entries from the database only the first entry is displayed correctly , the other entries in the menu are displayed as code. I'm using Xamp with PHP 5.3 and HeidiSql.This is my code :
<div id="1" class="mega solidblocktheme">
<div class="column">
<ul>
<li><a href="<?php include('../conect.php'); $result=mysql_query("SELECT * FROM tours");
while($data=mysql_fetch_row($result))
{ echo $data[2]; ?>"> <?php echo $data[1];
echo "</a></li>"; }
mysql_close($con);?>
</ul>
</div>
</div>
Your loop seems to be in the wrong place. Try something like this:
<ul>
<?php include('../conect.php');
$result=mysql_query("SELECT * FROM tours");
while($data=mysql_fetch_row($result))
{
echo '<li><a href="'.$data[2].'">'.$data[1];
echo "</a></li>";
}
mysql_close($con);?>
</ul>
You should not do it this way .
while($data=mysql_fetch_row($result))
{ echo $data[2]; ?>">
echo ""; }
For every loop , you are just adding content and close tags </a> and </li>
But you are not adding start tags for them .
What you can do is , first store your data result in a string
include('../conect.php');
$result=mysql_query("SELECT * FROM tours");
$data=mysql_fetch_row($result);
mysql_close($con);
$list = "";
foreach($data as $data_key) {
$list.= '<li> '.$data[1].' </li>';
}
So now you got your list
After that comes your HTML , just echo your built string
<div id="1" class="mega solidblocktheme">
<div class="column">
<ul>
<?php
echo $list;
?>
</ul>
</div>
</div>