Bootstrap : anchor with i class - codeigniter

I'm using twitter Boostrap, my navbar look this way :
<li><a href="#"><i class="icon-bar-chart"></i>
<span class="hidden-tablet">MyTitle</span></a>
</li>
When I'm trying to replace the href with an anchor, my Bootstrap icon is no longer aligned with MyTitle (not on the same line).
here is what I've tried :
<li><?php echo anchor('mycontroler','MyTitle')?><i class="icon-bar-chart"></i>
<span class="hidden-tablet"> </span>
</li>
Any clues ?

In the second block of code, the icon is outside the anchor tag. To replicate the code from the first block, you shoud have:
<li><?php echo anchor('mycontroler','<i class="icon-bar-chart"></i>
<span class="hidden-tablet">MyTitle</span>')?>
</li>
This should also solve the alignment issue.

Related

Thymeleaf/SB How do I pass in a variable from an object to a link element's href attribute?

I want to pass in the project.url variable into the th:href attribute of the element, but currently the URL that is navigated to is - /project/project.url/contribute which is obviously not what I wanted to happen.
The list above the button displays the project object's information and the URL is shown correctly.
<ul>
<span>Title: </span>
<li th:text="${project.url}">Title</li>
<span>Started: </span>
<li th:text="${project.publishedOn}">Started</li>
<span>Target: </span>
<li th:text="${project.targets}">Target</li>
<span>Description: </span>
<li th:text="${project.description}">Description</li>
<span>Amount Contributed: </span>
<li th:text="${project.amountContributed}">Amount Contributed</li>
</ul>
<div class="contributeButton">
<button>
<!-- Contribute -->
<a th:href="#{/project/${project.url}/contribute(action='show_all')}">Contribute</a>
</button>
</div>
What href do I need to put inside the link for this to work correctly? Thanks.
You can use concatenation to do this. I haven't tested this but give it a try:
<a th:href="#{'/project/' + ${project.url} + '/contribute(action=\'show_all\')'}">view</a>
You should be taking advantage of Thymeleaf's standard URL syntax for this:
<a th:href="#{/project/{url}/contribute(url=${project.url})}">view</a>

How to find xpath in label class?

Can someone assist, I need to identify the xpath that's inside label class for the last ticket-type. The .html code is as below.
<div class="vertical-accordion">
<ul id="accordion-5" class="accordion">
<li class="open-li">
<a class="toggle-link open" href="#">
<span>Tickets on your smart card</span>
</a>
<div class="accordion-drop" style="display: block;">
<ul>
<li>
<li>
<li>
<label class="ticket-type">megarider</label>
<label class="validity"> (7 day: 16 June to 22 June 2016 ) </label>
</li>
</ul>
</div>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
</div>
</div>
</div>
</article>
If you want to find the last ticket-type, I assume that there are multiple ticket type...
You didn't provide a lot of HTML, I'll answer with that assumption :
//label[#class='ticket-type'][last()]
Hope it'll help !
You can use this xpath to find the element in your example:
//label[#class='ticket-type'][1]
Open up this page using Chrome, Hit F12 Developer tools, Inspect the element, find the label in the F12 window (Elements Tab) right click on the label tag and select Copy -> Copy XPath

How to make Xpath for button “li” elements of “ul” in Selenium WebDriver

I'm new to Selenium webdriver. Can someone help me how to make Xpath for (Flag button) on below code.
<div class="right-pan">
<ul class="right-pan-btn">
<li class="closeandtrain">
<a class="gray-color" onclick="btnChangeReviewStatusClick(3)">
<span class="statusiconclass icon-close1"/>
Close
</a>
</li>
<li>
<a onclick="btnChangeReviewStatusClick('3_1')" title="Close and train this policy">
<span class="icon-hats"/>
Close
</a>
</li>
<li class="noclassName">
<a onclick="btnChangeReviewStatusClick(4)">
<span class="flag"/>
Flag
</a>
</li>
<li>
<a onclick="btnChangeReviewStatusClick(5)">
<span class="esc"/>
Escalate
</a>
</li>
<li>
<a onclick="btnCaseClick()">
<span class="case"/>
Case
</a>
</li>
</ul>
<ul class="right-pan-links">
</div>
I tried it on Fire path that path is not working and its showing (Unable to locate element) exception
try xpath //span[#class='flag']
I am not able to comment to your post, so posting this as answer.
You can go through this link to learn about xpaths.
http://www.tizag.com/xmlTutorial/xpathtutorial.php
Can you try this
I think you should click parent of span
//span[#class='flag' and text()='Flag']/ancestor::a[1]
or
//span[#class='flag' and text()='Flag']/..

how can i magento remove v:Breadcrumb - format error

For some reason, breadcrumbs is formatted all wrong - arrows over text and the start of breadcrumbs is way over to the left and not in-line with the template
Problem Code:
<ul>
<li class="home">
<span typeof="v:Breadcrumb">
<a property="v:title" rel="v:url" title="Go to Home Page" href="your-url/">Home</a>
»
</span>
</li>
<li class="category96">
<span typeof="v:Breadcrumb">
<a property="v:title" rel="v:url" title="" href="your-url">Accessories</a>
»
</span>
</li>
<li class="category6">
<span typeof="v:Breadcrumb">
<strong>Scope</strong>
</span>
</li>
Using Firebug i found that if i make these changes, then it is displayed exactly as i required:
<ul>
<li class="home">
<a property="v:title" rel="v:url" title="Go to Home Page" href="your- url/">Home</a>
»
</li>
<li class="category96">
<a property="v:title" rel="v:url" title="" href="your-url">Accessories</a>
»
</span>
</li>
<li class="category6">
<strong>Scope</strong>
</li>
PROBLEM
Where do i make these changes in the file structure of magento?
could be a school boy error but has been driving me mad all day
any help much appreciated
Breadcrumb content are rendered from the following file
app\design\frontend\<your_package>\<your_theme>\template\page\html\ breadcrumbs.phtml
If the file is not present in your theme. Get the copy of the file from base/default or rwd/default theme.
Then paste it in your theme with above file path.

A weird thing of Magento breadcrumbs?

<ul>
<li class="home">
<a title="Go to Home Page" href="#">Home</a>
<span>/ </span>
</li>
<li class="category3">New Arrival<span>/ </span>
</li>
<li class="cms_page"><strong></strong>
</li>
</ul>
Above is the html code of site breadcrumbs. Why do my template breadcrumbs add this code <li class="cms_page"><strong></strong></li>? All the code in the breadcrumbs.phtml of the base template are the same when i change the theme to default. There is no
<li class="cms_page"><strong></strong>
</li>
What's wrong with my template? thank you
are you sure you are editing the right template? To verify that turn on template hints from system > configuration > developer

Resources