Jump to content

Search the Community

Showing results for tags 'url segments'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 9 results

  1. Hello, i read that "URL segments only apply if the requested URL did not resolve to an actual page." (from here) Is there a way to change this behaviour? I have a parent page loading his children via ajax, and i know which children to load from url segments. So that would be nice to have url segments to have precedence instead of children's url. Thanks!
  2. So I have been hard at work creating url segments for a template (api) and everything is working swimmingly in creating a simple end point for svelte.js. I have however, run into a few questions that I can wrap my head around. In my api template I have: if($input->urlSegment1 === 'clients') { header('Content-Type: application/json'); $clients = $pages->find("template=clients"); $client_array = array(); foreach ($clients as $client) { $id = $client->id; $title = $client->title; $url = $client->url; $clientName = $client->client_name; $clientColor = $client->client_color->value; $assigned = $client->assigned_to->user_full_name; $client_array[] = array( 'id' => $id, 'code' => $title, 'name' => $clientName, 'associated_users' => $assigned, 'url' => $url ); } $client_json = json_encode($client_array, true); echo $client_json; } The output json from this is: [ { "id":1644, "code":"abc", "name":"Test Name", "associated_users":null, "url":"\/pw\/clients\/abc\/" }, { "id": 1645, "code": "xyz", "name": "Test Name", "associated_users": null, "url": "\/pw\/clients\/xyz\/" }, ] I was curious is it possible to add in "clients" before this output json so it would appear as clients: [ { "id":1644, "code":"abc", "name":"Test Name", "associated_users":null, "url":"\/pw\/clients\/abc\/" }, { "id": 1645, "code": "xyz", "name": "Test Name", "associated_users": null, "url": "\/pw\/clients\/xyz\/" }, ] I was not really sure of how to tackle this in my php code, and have spent more time than I care to admit trying to figure it out. Another question I have is that "associated_users" is returning null, which in this instance is correct. It is a multi page field that is set to pull a custom name field from the users template, ie "Louis Stephens" would be associated with the first page. I understand that I need to use a foreach to get the correct data, but I was really unsure of how to place this inside an array, or update the array with the new data. Any help with any of this would greatly be appreciated.
  3. So I have a project coming up soon and one of the goals was to use Google's AMP project for the project's mobile site. I have gone through the tutorials and think I have a good grasp on the matter, but there is still one roadblock I do not really know how to tackle. The site, which uses a responsive grid system, will look great on a mobile and desktop which was is fine by me. However, if a user comes from Google to one of our AMP pages (ie www.example.com/amp) and clicks on a url, they will then be loading our responsive mobile pages and not the amp pages. For the sake of consistency, we really want to "force" users to stay on all the amp pages. My current thoughts on how to set up this task: Allow url segments for all pages using "/amp" Using a simple if statement, load the amp page if it exists <?php if($input->urlSegment1) { // add "&& $input->urlSegment1 == 'amp'" if you've more urlSegments include("partials/amp-page.php"); } else { include("partials/normal.php"); } ?> However, I have hit a roadblock on appending "/amp" to all pages if they came to an amp page via Google, or even if they are on mobile and visit the site. Is this even possible to do, or should we just use the amp pages (if a user comes from google) and allow them to be active on our mobile pages? We are just trying to give the fastest load times possible, as well as give a consistent look between mobile and desktop versions. As always, I really appreciate the ideas and help.
  4. Greetings! For our PW project we use markup regions and, for one template, url segments. The documentation recommends throwing a new Wire404Exception() from the template when the code concludes that the url segments from the request are invalid, and so we do. However, the 404 page is not displayed properly. Viewing the page source in the browser we can see that the original, unmodified markup region contents from our _init.php file is prepended to the correct html output, messing the whole page up. Any advice is greatly appreciated.
  5. Hi everybody I want to catch a variable from outside processwire into _main.php if(isset($_GET['u']) && $_GET['u'] !== ''){ $gebruikersnaam = $_GET['u']; ... ... This is working fine in a php file in a non processwire environment. In a processwire environment, I get the variable when I refer to /site/templates/_main.php but a great part of my template-code is not shown. From outside processwire I refer to mydomain/index.php. If I place $gebruikersnaam = $_GET['u']; in index.php, how can I pass through my variable to _main.php? Or is there an other solution? thx hansv
  6. I have a parent page (with template file) with several child pages (without template file) that are hidden and unpublished, I use them only to store information. The parent page have the url segments enabled. When I catch the segment in the template file, works as expected for any word, but if the url segment match the property "name" of any child page, PW launch a 404 Page Not Found.. I try all combination of "hidden" and "Publish" for the child pages. The idea is to render the data from the parent page plus the data of a child page, and get this data using an url segment (links generated dynamically) with the same name that this hidden page have.. I don't like having a template file for these child pages that only execute the render of the parent page with the information .. I want the previous solution if it possible I was able to explain well? ...What happen here?
  7. Hey there, I have a problem with URL Segments and Umlauts in it. I want to grab the a segment of the url and use it as a parameter to find a something in Processwire. The problem is, that if I input an umlaut into the url, processwire immediately throws a 404 error page and I am not able to transform my inputs. Is there a way to get around that problem? Cheers, Evan
  8. Hi guy's I'm new with PW and very happy with it - thanks alot Ryan and team for this great work! I just completed the simple news system tutorial on the wiki page (thanks alot to the author - who was it?) - works perfect, except for one thing: I would like to get the categories-breadcrumb - when a news list of a specific category is displayed - take me to the main news page with all news items listed. Now it gives me 404. Allowing the url segment news/categories - where the breadcrumb points to - in the TUT_news_index template or the TUT_news_index unfortunately didn't make it work. Same problem with the news-articles breadcrumb link on the article display page. See attached screenshots. Is anyone familiar with the tutorial / the simple news system and coud give me a hint? Thanks alot for any help in advance. Cheers, Markus from beautiful Switzerland
  9. It's possible that I'm missing something, but I think I have found an small bug. I am doing a simple page list template (/photos) that is paginated and has url segments on, to allow for filtering through tags. As there are multiple different lists, and they all share the same tags, I need to list the tags that are relevant to this particular list (i.e. the tags that are in any of the list's pages). I attempted: foreach ($pages->get("/tags")->children() as $key => $tag) { if($pages->count("parent=$page, tags=$tag") > 0){ echo "<li><a href='$page->url$tag->name' $active>$tag->title</a></li>"; } } And it seemed to work... BUT it broke on my final page (on page 3 of a 3 page pagination). After doing some testing, I found that this selector, when using pagination, correctly counts all the pages that have the given tag, only if there is at least one in the current page. So: If tag A is in 10 pages, and in the current pagination segment there are any of them, the selector returns 10, as expected If tag B is in another 10 pages, but none of them are in the current pagination segment, the selector returns 0. If I change the selector to address all pages, removing the parent selector, the problem goes away but:Any parent selector pointing to the current parent (being paginated) break this, be it $page, $page->id, or the url or id entered manually The problem occurs without any url segments actually being used. Haven't tested thoroughly enough to be able to tell if it has the same behaviour with url Segments set (i.e. on a tag-filtered subselection of the pages) This was using a page field with multiple pages (as it was for tags) I solved the problem using: foreach ($pages->get("/tags")->children() as $key => $tag) { if($pages->find("parent=$page, tags=$tag")->count() > 0){ echo "<li><a href='$page->url$tag->name' $active>$tag->title</a></li>"; } } Which works well. I can only think of this as a bug, but I may be missing something.
×
×
  • Create New...