stanoliver Posted August 12, 2019 Share Posted August 12, 2019 Hi! 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. <?php $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 <?php 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 url_redirect|url works just fine but when I try something similiar in the second code snippet $parent->url_redirect|url 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 More sharing options...
BitPoet Posted August 12, 2019 Share Posted August 12, 2019 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>"; 1 1 Link to comment Share on other sites More sharing options...
stanoliver Posted August 12, 2019 Author Share Posted August 12, 2019 @BitPoetThanks! It works and processwire would even rock better if php was not such an awful language. Link to comment Share on other sites More sharing options...
dragan Posted August 12, 2019 Share Posted August 12, 2019 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". 2 Link to comment Share on other sites More sharing options...
stanoliver Posted August 12, 2019 Author Share Posted August 12, 2019 @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 More sharing options...
wbmnfktr Posted August 13, 2019 Share Posted August 13, 2019 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. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now