Cakephp breadcrumbs getCrumb root url - cakephp

I'm setting up breadcrumbs in cakephp following the cookbook (cookbook). I'm doing this in my admin section (admin routing is on) and in my layout I have the line
echo $this->Html->getCrumbs(' > ','Home');
I change home to Admin Home and it displays fine, however the url links back to the website root i.e. website.com/ instead of website.com/admin. I've been looking around and can't find anything on this. I tried leaving out the second parameter in the method call which should then make it display the first breadcrumb in the array however it only shows the current breadcrumb for each page, not the whole trail.
Any help much appreciated.

You can see that the getCrumbs is hardcoded to '/'. You'll have to override getCrumbs to linking to admin, or alternatively just add an
$this->Html->addCrumbs('Admin','/admin');
to your code

You could use this line of jQuery:
$('#breadcrumbs').children('a').first().attr('href','/admin')
If upgraded to CakePHP 2.1, there is now support for array as the second param.

Related

Redirect to an external page from a specific article - Drupal 7

I'm very new with drupal.
I have a blog, List of posts.
I need redirect a specific post to a specific external webpage, Is this possible ?
By example: I need to redirect the post (with the arrow red) to www.facebook.com/somePage. (if it's possible in other tab)
But the other posts should be redirect normally to its internal pages.
In this moment I have this configuration:
Any suggestions?
Method 1
Add a URL Redirect pointing from the 'node/#' URL to your external URL.
Render View as you have it now, and when you click the article Title it'll send you to the external page.
Method 2
Install the 'Link' module.
Add a 'Link' field to your Content Type. Configure the link field to open links in a new window, and so on.
Add that new field to your View. Set it to not appear in display, so it can be used later. Move this link above your Title Field in the View, because the order matters.
Edit the Title field settings and use the Link field value as a Token for the Title field.

Pretty url with Angularjs/.htaccess

I've been struggling with this for a week now. I use Anguarjs and I set the html5mode(true) to get rid of the hash sign "#" that you needed in the url before.
Everything works fine amd my URL logic works with Query Parameters.
www.domain.com/thecurrentpage/?title=banana
And it changes and refresh the page when I click on something else and then it displays the right content.
I just want to be able to have a link like:
www.domain.com/thecurrentpage/banana
And come to the same page.
That actually will point you to the first one with query params.
I feels like I've tried everything in the .htaccess file with rewrite rules and everything with angular routing. I just don't get it.
you want to use the : syntax in your routing.
In your routing add a route like this:
/thecurrentpage/:title
Then you can use:
$routeParams.title
To get the value "banana"
This might help ... AngularJS: Read route param from within controller

angular automatically removes parameters form url

In my application i am passing parameters for controller and read it using javascript as below.
localhost:8080/app/conroller#parameter=value
now problem is if i open my conroller in url and than append #parameter=value than only it works.
but i want to put whole link in anchor tag.
and when i click outside application than it automatically reroute localhost:8080/app/conroller and don't accept parameters.Although when opening that url if i apped #parameter=value* part than it works perfect.
i am using html5mode = true.
i search lots of document but didnt find right solution for this.
Not exactly sure if I get what you are asking but I think this is what you are getting at:
href="/app/conroller#parameter=value" target="_self"
Try adding the target self.
If that doesn't work you could try setting a base url <base href="/"></base>
You could try using ? for the query parameter instead of the #

Generating random URL in AngularJS

I wish to see if it is possible to generate a random link each time an admin visits the admin page.
for example: instead of having: "".com/admin, there would be "".com/a93k, "".com/9dik. The page stays the same but just so the end-user can't access the page from the address bar.
Thanks as I am new and do not know how I can implement this.
In .config of your app put something like
window.adminHash = Math.random().toString(36).substring(2,6);
In your routing
url: '/' + window.adminHash
Then you can use "window.adminHash" if you want to redirect to your route, which will change every time you refresh the page
You can add www.test-example.com/admin/{provide some ID}
And If there isn't ID provide discard that URL, if it is provided you can make discrimination.

How to use hash (#) on urls in chaplin.js like backbone used to do?

let's say that I have two "pages" (endpoints) on a chaplin.js site
the routes:
match('', 'first_controller#show');
match('second_view', 'second_controller#show');
and two links:
Go to home
Go to Second
the generated urls are "correct":
mysite.com/something/ (home)
mysite.com/something/second_view (second view)
(notice that I'm not on the root of the site). When I start the application at "home" and then click the "Go to second" link i get correctly redirected to the second view, everything gets tendered correctly and the url on the browser changes to mysite.com/something/second_view
But then I cannot refresh the navigator since my webserver will try to reach a second_view folder instead, and I'll get a 404.
What i need is to always generate the urls using a # like in backbone, something like mysite.com/something/#/second_view.
BTW: that last link works but chaplin deletes the # (like a redirect)
Maybe I need to configure something? or change something on the ùrl`helper, I couldn't find anything in the docs. Any Ideas??
Thxs
Backbone itself allows this functionality out of the box, through
Backbone.history.start({pushState: false})
(the default)
You can see the startHistory call here.
You just have to pass this options object as a second parameter to initRouter in your Application :
this.initRouter(routes, {pushState: false});

Resources