Search the Community

Showing results for tags 'url'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • 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

Found 55 results

  1. Another dumb question: Is there a field type for a text-based array? In my case I need to store an array of RSS feeds for SimplePie. Storing that list of links in a textarea - text formatted to look like an array - doesn't work with the script. It works with one link. The images field is an array. I assumed there would be an equivalent for URLs or text in general. Or is there another approach for these cases? Edit: I guess using the optional (module) Repeater field type is the best solution in this case? I have now a working solution based on that. Still curious about other ideas.
  2. I've been working with different CMS's for quite a few years now but there was always one thing that bugged me, I never knew how the CMS takes a url and resolves a page ID from it. I knew it was to do with the "slug" but what i couldn't figure out is when it came to sub pages, as the slug only refers to the page itself not the parent pages in the url e.g /parent-page/sub-page. The main two CMS's i've worked with are Wordpress and ProcessWire, ProcessWire always has the upper hand when it comes to speed, even a large PW site is tens of milliseconds faster than a fresh Wordpress install. With the resolution of urls to pages being (probably) the most used query in a CMS i thought i'd investigate the two different approaches. Both ProcessWire and Wordpress split the urls by forward slash to extract the slugs /about/people/ => ['about', 'people'], however ProcessWire takes a completely different approach when it comes to resolving a page ID from these slugs. ProcessWire uses this query: SELECT,pages.parent_id,pages.templates_id FROM `pages` JOIN pages AS parent2 ON ( AND ('about')) JOIN pages AS rootparent ON ( AND WHERE'people' AND (pages.status<9999999) GROUP BY LIMIT 0,1; Resulting in a single item of the page in question including the page's template id. For urls with more parts it looks as though ProcessWire creates more JOINS to essentially walk back up the hierarchy and fully resolve the ID of the correct page. Wordpress on the other hand takes a different approach: SELECT ID, post_name, post_parent, post_type FROM wp_posts WHERE post_name IN ('about','people') AND post_type IN ('page','attachment'); More elegant looking however it returns a list of potential items. So requires a loop within PHP to walk the hierarchy tree and determine the correct page ID. Both queries once cached by MySQL took 19-21ms to return, ProcessWire looks as though it uses this to it's advantage by returning the correct page ID straight from the MySQL cache and doesn't require the extra looping step afterwards. Interesting to see the different approaches to the same problems.
  3. Hello, I'm wondering how to add the value of a field to a URL when submitting a form, while also processing the form with FormBuilder and storing the entry in the CMS. Is this even possible with the versions below? FB 0.2.5 | PW 2.7.2 Is there still a dedicated Form Builder forum here anymore?
  4. Hello, I am just working on a multi-language pw app. Default language is german, then comes english. the language segment for english in the url is 'en-home' , eg. '../en-home/products', I think this was taken as a default option. (this happened several months ago, so I do not remember exactly...). Now I want to change this segment simply to 'en'. However, in 'Pages...Settings', only the part AFTER 'en-home' is editable, so I do not see any possibility to change this segment. Neither do the Languages Settings offer such a possibility ;-(( Or do I miss something?
  5. Hello, I need some help with changing the URL for default language pages. I have two languages one is hidden at the moment for future use. Now I would like the default language URL to be only the site name and a page without /en how can I achieve that. I want my URL to be like and not Now only the home page has the right URL all other have /en. ... I looked through the forum but no luck so far. Thank you R Ok, I got it, I just had to delete the EN in my homepage setting and now it is working, I found it on a forum. Thank you anyway
  6. Hi, In one Page I would like to put a lot of url. There is url's field. Now, I add url's field to one template, but I don't know to add 2 or 3 or 10 url's field in that same template... the problem is simple, but processwire don't allow it...
  7. Hi all. Some days ago I migrated my website from local (xampp) to online. Everything works fine exept one thing. When i try to fill a field of the type "url" (with an external link) i get an 403 - forbidden message. Writting text in textfields , body etc. works. Now I don't know if the problem comes from processwire or the server itself... Did anybody have the same/similar troubles? Thanks for helping! cheers
  8. Hello, I have a Process module with a user dashboard and I would like to have the user page edit screen at a custom URL 'myprofile'. I cannot use the default profile edit page because it does not support tabbed interfaces. The method for executing the user edit page from within my module looks like this public function ___executeMyprofile() { $processUser = $this->modules->get('ProcessUser'); return $processUser->executeEdit(); } The user edit screen displays when I go to /dashboard/myprofile. But the request is redirected several times and I end up at the URL /access/users/edit/?id=5522 which I wanted to avoid. This happens because of this line in ProcessPageEdit.module. I guess the solution lies in hooking into the ___loadPage() method from within my Process module. But, honestly, I have no clue on how to put the pieces together. So I need some pointers on how to best achieve the goal of having the current user's edit page under a custom URL in the admin area, ideally in the scenario of a custom Process module. Any help would be much appreciated. EDIT: I tried some variations of hooking like public function ___executeMyprofile() { $this->addHookBefore("ProcessPageEdit::loadPage", $this, "interceptRedirect"); $processUser = $this->modules->get('ProcessUser'); return $processUser->executeEdit(); } protected function interceptRedirect(HookEvent $event) { $event->replace = true; $event->return = $this->user; } but the hook is not being executed at all. Also when placing the call to the hook in my Process module's init() method. Also when using an After hook and not replacing the hooked method. No luck so far...
  9. Hello! I have a very special Processwire Setup. Short: We use Processwire for our "Blog", which is embedded in an SAP Hybris Webshop. PW provedes the Contnet via HTML and Hybris render this HTML into the Webshop (Between Default Header, Navigation and Footer) The URLs which are created in PW are the URLs for the local HTML e.g.: If some Editor creates an article, he want to see the preview in the real webshop embedded. This URL would be: http://www.webshop.coom/en/blog/news/some-article Where and how can I create a Module which overwrites the URL with the correct one in the Admin-Area?
  10. Hello (again), My project is a multilanguage one. On the homepage, I have a header menu where I display link of features, example : <?php $lg = $session->lg; echo $page->localHttpUrl("$lg").'dashboard'?> ?> My website displays french by default. The homepage is : (in french default language) The link in the code above is rendered as : When I click on this link, it does a 301 -> dashboard is a child page of the homepage. When I does the same in a non default language, such as 'en' / english for example, it doesn't do that 301 because the generated link in my code is I know there is an option in the core module LanguageSupportPageName to prefix the page of the default language by 'fr' (in my case), but apparently it's not recommended. "Choose Yes if you want the homepage of your default language to be served by the root URL / (recommended). Choose No if you want your root URL to perform a redirect to /name/ (where /name/ is the default language name of your homepage)." Maybe it's not recommended because it's causing a 301 when you arrive the first time on the homepage (from / to /fr). So how I could generate my link in the menu such as it displays ? I can do it by hacking some php of course, but perhaps there is a PW way to do it ? Thanks
  11. Hi there, I was wondering if page->url and page->httpUrl are stored anywhere in the backend? I haven't been able to locate it so I'm beginning to think these are generated or calculated on the fly? Thanks in advance
  12. Hello, Is there a way to regenerate the name from the title in the API, like: $myPage->regenerateName(); $myPage->save(); or similar? I'm looking to batch rename a lot of urls, but only once.
  13. Hi there, I am using a url schema like this: page.html page1.html etc. As the name unter settings. I don't want to start a discussion about how useful .html is Works but not for pages that have child pages, where the path would is page.html/child1.html page1.html/child4.html The page and page1 should be without html if I access the children and with if I click the parent.
  14. Hi guys, I'm a Processwire-Newbie and new to this forum. Happily I have to struggle with very few difficulties, thanks to the clear and pleasing concept and structure of PW. Currently there is only one thing that makes me brood: I have a main category 'posts' that contains the majority of all pages. So the regular url would be 'domain/posts/post-one' etc. As I prefer the url scheme 'domain/post-one' I followed the instructions discussed in this topic. This hook is in my 'init.php': wire()->addHookBefore('Page::path', function($event) { $page = $event->object; if($page->template == 'post') { $event->replace = true; $event->return = "/$page->name/"; } }); And this is in my 'home' template: if(strlen($input->urlSegment2)) { throw new Wire404Exception(); } else if(strlen($input->urlSegment1)) { $input->urlSegment1; $name = $sanitizer->pageName($input->urlSegment1); $post = $pages->get("/posts/")->child("name=$name"); if($post->id) echo $post->render(); else throw new Wire404Exception(); $renderMain = false; } else { // regular homepage output $posts = $pages->find("parent=/posts/, limit=$limit, sort=-date"); $body = renderPosts($posts); } Both templates 'home' and 'post' have 'url segments' option activated. On the first sight everything is working fine. $page-name outputs '/domain/post-one' and the page '/domain/post-one' ist getting displayed. What's frighening me is the fact, that 'domain/posts/post-one' is working as well. This means 'post-one' can be adressed with two different urls, and I’m not sure how to rate that. On one hand, nobody will ever notice the '/domain/posts/page-one' option, as it's listed nowhere. So I could just ignore it. On the other hand, I don't know for sure if this presumption is correct. Maybe there are unknown channels where the 'wrong' urls will be spreaded, then there will be 'doubled content' which is bad, as far as I know. So what I'm asking for: Is there an easy way to avoid the double url-scheme option and output a 404 error, when 'domain/posts/page-one' is called? Or should I just don't care, as it doesn't matter a all? Unfortunately, I don’t fully understand every line of the second code, so I would be very grateful if someone could light it up for me a bit. Thanks + regards Ralf
  15. Ill try to explain this as best I can. I am making a site map and using the following: foreach($page->sitemap as $site) { $out = "\n<url>"; $out .= "\n\t<loc>" . $site->httpUrl . "</loc>"; $out .= "\n\t<lastmod>" . date("Y-m-d", $page->modified) . "</lastmod>"; $out .= "\n</url>"; echo $out; } This works perfectly and the url displays as . I was wondering for the sake of this question, is there a way to only pull from /page-one in the url? I know $site->url would give me data/datasetone/page-one, but I really need just the page name
  16. Hi, I'm quite sure to have read everything, doc and forums, about urlSegment, but I'm still not understanding how to use it. After have set my categories with this excellent post, I'm unable to fix url as I want. Page title | Template | actual url | url I want Categ-publi | parent_categ | categ-publi/article | publication/article -- Article | categories | Publication | basic-template | publication/example1 | publication/article/example1 -- example1 | publication | For which template I should activated urlSegment and in which template file I should add some code, probably something like this (which didn't work obviously)? if($input->urlSegment1 == 'publication') { echo $pages->get('/publication/$categ/')->render(); return; } else if($input->urlSegment1) { // throw a 404 throw new Wire404Exception(); } Thanks so much. Melanie
  17. Preamble: Processwire is awesome and the freedom of development is quite insane. Issue: When using CKEditor and entering a URL, it says: "Enter a URL, email address, anchor, or enter word(s) to find a page." I have installed the multilingual module, so I need to target: /en/contact/ and /de/contact/ and /lt/contact/ Adding a link to the text, I can only add one of those 3 contact links. When copying the text (including links) into another body (another language), then I need to edit each link to set the correct language - every time. Idea for solution: Is it possible to allow entering either: 1. The page id (then the module could read this and create a URL), or: 2. A placeholder for the language, e.g. "*contact" (then the module could replace the asterisk with the language identifier) Thanks in advance for your ideas.
  18. Hi all, I'm experimenting building a content site based on AngularJS and Processwire. I‘ve turned on the html5Mode in angularjs, everything works so far re agularjs routing, but when I try to refresh a page, only loads a page without header (thus no js/style). This to me seems a classic problem with server setup ( ), which requires htaccess setup (I'm on Apache server). But not quite sure how to set up the htaccess? Attached is my htaccess, with below are some routing settings of angular: scotchApp.config(function($routeProvider,$locationProvider) { $routeProvider .when('/news', { templateUrl : 'news', controller : 'mainController' }) .when('/about', { templateUrl : 'about', controller : 'aboutController' }) .otherwise({ templateUrl : 'news', controller : 'mainController' }); $locationProvider.html5Mode(true); }); THANKS advance for all your help! htaccess.txt
  19. We have a members area (accessed via a login) which lists a load of horses. Much of the information here is members-only and has been stored as pages in the backend of the website (via a feed). We now wish to consume this information on the frontend (public) area of the site. In my template I can easily grab the horses and loop through them but on the frontend $horse->url returns the members area url so: members/horses/horsename Rather than /public/horses/horsename Is there a sensible way to solve this or am I going to have to resort to creating a custom URL format. grabbing a reference and passing it to the next page? Many thanks Pete
  20. I seem to be having trouble with url segments on a projects. I'm working on an arrest report system and will provide the structure. What I have is a page called arrests in the back end that loads up an arrests.php file. Under arrests, in the back-end (with URL segments enabled), I have two pages that only store data, they don't load actual .php files. structure in the back-end (see attached photo) /arrests (loads arrests.php) -February 2016 - a page that uses a template called arrestlog that only stores data, it has no .php file -March 2016 - a page that uses a template called arrestlog that only stores data, it has no .php file when my site loads /arrests/ my arrests.php performs a find('template=arrestlog') where I display only the most recent addition, in this case data for March 2016. So, if you go to /arrests/ in a browser, arrests.php does a $pages->find() and displays only March 2016 data. What I'm trying to do is create a "next" link that loads : /arrests/february-2016/ So, when arrests is passed a url segment1 I can pull that url segment, then run a find on it to display february data. I could use /arrests/?id= method to callback arrests.php passing a parameter, but, I'd rather use a friendly url segment if possible. The end result is I'm getting a 404. Assistance is much appreciated.
  21. The current use of relative urls (in my opinion) is great. However, I have a project that requires image paths to be absolute (using the source code module so the code can be dropped in different pages outside of processwire), ie: . Is this possible to do in processwire? I had searched around but couldn't find anything regarding the topic. Sorry, I forgot to post this. I am currently calling images like so: <?php echo $page->headerImg->url; ?> which produces: <img src="/testing/site/assets/files/1035/header.jpg" >
  22. One of my blogs seems to be accessible from multiple URLs and it's affecting my clients SEO. For example, using the following URL structures, I can access the same page. http://www.domain.not/blog/page2/ http://www.domain.not/blog/posts/page2/ The correct one is probably the second one as all posts are children of blog. My actual blog structure is as follows Blog - Posts -- Post A -- Post B -- Post C (etc) - Tags - Categories I have pagination enabled on a template called blog-posts which is applied to the Posts page. I'm not sure though why the double URL is occouring?
  23. I have an external database with a list of items, each one identified by an id. I would like to integrate this database into the CMS.<id> I have created a page, but not the dependent pages. If link to the ids, Processwire tells me that they don't exist. Can I use the id urls without creating the pages? The id urls should use the parent url as template and use <id> as a parameter. In short, a parameterized template.
  24. Hi, I created a table and have a column using the URL field type; how do I add a ahref tag via the API so that on the output, the URL is clickable? Below is the section of code and any suggestions would be great as I'm a newbie! foreach($page->tbl_CompanyURLs as $c_url) { if($c_url->url_company) echo "$c_url->url_company<br />"; if($c_url->url_updated) echo "$c_url->url_updated <br />"; } Cheers, Tiffany
  25. I thought I had this, but I guess my understanding of get/find for pages is a bit lacking (or perhaps nonexistent). I am trying to switch the stylesheet based on the URL using a simple if/else statement, but what I wrote doesn't seem to be doing the job. I currently just have two pages (that each need two different background images), but they share the same file. I wrote: <?php // Switch stylsheets based on site $styleSwitcher = $pages->get('/url-one/'); if($styleSwitcher){ echo "<link rel='stylesheet' href='{$config->urls->templates}css/one.css' />"; } else{ echo "<link rel='stylesheet' href='{$config->urls->templates}css/two.css' />"; } ?> I assume I messed up my "get" as both pages are still loading one.css