Jump to content

redirect url field for breadcrumbs


Recommended Posts


The following code snippet is part of my markup simple navigation and the url_redirect (url field in the backend) just works fine when I put an special custom url into the url_redirect field.

            $nav = $modules->get("MarkupSimpleNavigation");
            // topnav
            $current = $page->rootParent(); // current root page
            // subnav
            echo $nav->render(array(
                'max_levels' => 2,
                'item_tpl' => '<h4><a class="g8-bar-item g8-hover-black" href="{url_redirect|url}">{title}</a></h4><hr class="sidenav">',
                'collapsed' => true,
              ), $page, $current);

 In my seperated breadcrumb navigation I use the following code snippet

                                  foreach($page->parents()->append($page) as $parent) {
                                      echo "<li><a href='{$parent->url_redirect|url}'>{$parent->title}</a></li>";

Now to the problem: In my first code snippet above the


works just fine but when I try something similiar in the second code snippet


I produce an server error How do I have to change the second code snippet so that it works in the correct way as the first code snippet does?

Link to comment
Share on other sites

The first one is template syntax, the second one plain PHP.

echo "<li><a href='{$parent->get('url_redirect|url')}'>{$parent->title}</a></li>";
// or:
echo "<li><a href='" . $parent->get('url_redirect|url') . ">{$parent->title}</a></li>";


  • Like 1
  • Thanks 1
Link to comment
Share on other sites

35 minutes ago, stanoliver said:

if php was not such an awful language

no it isn't. What makes you say that?

Perhaps you should spend some time "learning the ropes" instead, before declaring an entire decades-long tried and tested scripting language as "awful".

  • Like 2
Link to comment
Share on other sites

@draganWell, I did not say that php is worthless because is one of the most used programming languages out there and it runs in a simple shared host enviroment.

Have a look at the elegance of languages like elixir, julia, ruby or even pyton then you will know why I consider php a mess. Php is the same mess as javascript  even when both languages are used heavily.

If python, julia or elixir would run in simple shared host enviroments for a 3-4 Euros a month then there would be no need for php anymore.

Link to comment
Share on other sites

A Ferrari 360 is way more elegant than a VW Golf V but still... you can't move more than 4 boxes (4x 12 bottles) of beer with it.

So... if you feel fancy, you can pay for it - as in hosting prices. Actually Python is supported pretty good in most of the hosting environments I know. And compared to cars it's kind of a Porsche Cayenne and you can move 10 boxes of beer with it and still can go 230km/h if you wanted to.

  • Haha 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...