Laravel Routing to Views in Subdirectories - laravel

I'm using Laravel, and have a view structure like such:
Each of my pages have a navbar at the top, and the navbar has a few links on it:
<ul class="uk-nav uk-navbar-dropdown-nav">
<li>KENNEL INFORMATION</li>
<li>SIRES & DAMS</li>
<li>LITTERS</li>
<li>HELP</li>
</ul>
If I click one of these links (lets say info) from the homepage (home.blade.php), it redirects to the following url:
localhost:8080/mykennel/info
However, if I'm already on a view that is in the mykennel subfolder (again, lets say I'm on the info page), and I click a link from the navbar, it redirects to:
localhost:8080/mykennel/mykennel/info
Which throws a 404. I understand WHY this is happening but I can't seem to find how to fix it. How can I create an href in my anchor tag that knows to use only a single /mykennel/ prefix, regardless of where the user is currently situated on the site?
Any help is appreciated.

Try to use an absolute path instead, by adding / at the beginning of the href so links:
<ul class="uk-nav uk-navbar-dropdown-nav">
<li>KENNEL INFORMATION</li>
<li>SIRES & DAMS</li>
<li>LITTERS</li>
<li>HELP</li>
</ul>

Related

Ignore element inside only certain divs

I have a basic web scraper written which pulls short sections of text from a webpage and puts them into a list. My problem is that there are dynamic ads that appear on the page and mess up the lists.
The page I'm scraping is a Yelp restaurant listing page.
I pull out the biz-name (business name) and add it to the list and it works fine but when the ads appear the scraper pulls the biz-name also.
This is the structure but I can't figure out how to ignore the 'AD element' and just scrape the normal business names. I've cut it down a lot and removed the 'unimportant' elements.
This is with an AD:
<li class="yloca-search-result">
...
...
<a class="biz-name"...><span>San Lorenzo’s</span></a>
</li>
This is a normal listing:
<li class="regular-search-result">
...
...
<a class="biz-name"...><span>BigGrill</span></a>
</li>
I've been trying to make Nokogiri ignore the business name inside the <li class="yloca-search-result"> and only select the others inside the regular-search-result class.
I can't figure it out. Can someone point me in the right direction at least? Is it possible?
I figured it out. Wasn't difficult but I just couldn't see the answer.
ad = doc3.at_css("li.yloca-search-result")
ad.remove

How to sort Tumblr posts by tag without changing page?

I tried this code:
{block:Posts}
<ul>
{block:HasTags}
{block:Tags}
<li>{Tag}</li>
{/block:Tags}
{/block:HasTags}
</ul>
{/block:Posts}
However when you click one it takes you to another page. How can I make this sort them without going to another page?
Example of the sorting I want to achieve: http://purifytheme.tumblr.com/

change a GET method URL to SEO URL in Joomla 3 component

I want to send a parameter form a module to a component in Joomla 3 (it's a date to show its articles).
So I send the date by GET Method like this:
<a href="http://127.0.0.1/web43/archives.html?date=2014-12-29&option=com_arch&Itemid=10371">
list of articles on 2014/12/29
</a>
Everything works. I can get parameters on PHP file in model folder in com_arch component...
but this URL is ugly and unfriendly for search engines.
I want something like this:
<a href="http://127.0.0.1/web43/archives/2014-12-29">
list of articles on 2/2/2014
</a>
Is it possible? How can do it?
Hope this helps:
http://docs.joomla.org/Supporting_SEF_URLs_in_your_component
Its about router.php file.

Blogger: Custom Social Share Links With Page URL

I'm working on a Blogger template with custom social sharing buttons. The problem I'm having is adding the Current Blog URL to the link.
Here is my code:
<li class="googleplus"><span>Google+</span></li>
If I leave it like that, then when I click to share the webpage, it actually shows data:blog.url, instead of the actual webpage URL.
I tried using:
<li class="googleplus"><a expr:href="https://plus.google.com/share?url=data:blog.url"><span>Google+</span></a></li>
However, that just makes the whole menu not appear at all(even omitted from source).
Is there a solution for this, or am I gonna have to use jQuery to grab the URL and insert it into the link?
This is what i use and it works perfectly
expr:share_url='data:post.url'
OR
<li class='google'>
<a expr:href='"https://plus.google.com/share?url=" + data:post.url' onclick='javascript:window.open(this.href, "", "menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600");return false;' rel='nofollow' title='Share this on Google+'>
<strong>
Google+
</strong>
</a>
</li>
use this code :
<a expr:href='"https://plus.google.com/share?url=" + data:post.url.canonical' expr:onclick='"window.open(this.href, \"_blank\", \"height=430,width=640\"); return false;"' target='_blank'><span>Google+</span></a>

how do i link to a specfic block in a page?

I had displayed part of "latest testimonial" (textarea) on my home page, and placed a "view more" link in the end.
Now I want to link to that specific testimonial on a page when "view more" is clicked.
But I had a list of testimonials on a single testimonial page, meaning no separate detail page for each testimonial. So how can I display the specific testimonial on the page ?
<?php echo $this->getUrl('testimonial'); ?>
this gives a link to my testimonial page.
First you need to provide some element IDs on your testimonials page. For example if each testimonial is in a quote:
<blockquote id="testimonial001">
...
</blockquote>
Or place a named anchor just before each testimonial:
<a id="testimonial001"></a>
...
Then your URL can be built with a fragment:
<?php echo $this->getUrl('testimonial', array('_fragment'=>'testimonial001')); ?>
By specifying the ID through a route parameter you will override any other fragment that might get set by another module (don't know which, just know that it can happen) which is preferable to merely appending it.
example below should generate a link this this: http://www.example.com/testimonial#anchor
<?php echo getUrl('testimonial'); ?>#anchor
The rest you can find in this document: http://www.w3schools.com/tags/tag_a.asp
using this example: http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_link_bookmark

Resources