Search the Community
Showing results for tags 'routing'.
-
Hello, this feature wish came up while I was working on my first bigger project with ProcessWire. While almost all of the CMS is very well thought out there was one thing that always kept me thinking "where should I put this?": simple page actions. What I mean is code snippets that belong to a page and should be run when a certain action is taken. E.g. when a user submits the form on my contact page (that has the contact template) I somewhere have to validate the form and then send it somewhere. So far I see two options to do that. Write a module that hooks into some methods and checks if the post data is set and if the page is my contact page This aproach is clean but it's usually a lot of overhead to write a module just for that Write the code in my contact.php template This aproach is fast but feels really dirty. It does not help to separate the logic from the design which I fear in a long term could lead to some Wordpressish code structure Now since I don't have so much experience with ProcessWire there might be a chance I missed something, but then it's probably not documented obvious enough. So I thought how you improve on this problem and came to a solution, that's again really close to the syntax that jQuery provides. If we had some kind of routing system we could register those actions in any file, for example the templates _func.php <?php // execute this action when a post request is sent to /contact // the parameters given to the callback function probably should be different wire('request')->on('post', '/contact', function($request, $input) { // do an action } // do the action for any post request wire('request')->on('post', function($request, $input) { // do an action } // do the action for get requests on contact pages wire('request')->on('get', 'template=contact', function($request, $input) { // do an action } // do the action on ajax-GET requests wire('request')->on('get.ajax', '/contact', function($request, $input) { // do an action } Is that something that could improve the work with ProcessWire? What's your honest opinion about it? If that's a useful suggestion I would like to help with the implementation. Regards Alex
-
Hi, I'm about to implement a multisite project with PW3 (which is great btw!!!). Because of "reasons" I need to implement my own routing. To do this I implemented a little module the hooks ProcessPageView::execute(). I reviewed its code and found out, that the actual logic to look-up the requested page from the request is placed in a protected method ProcessPageView::getPage(). And because this method is currently not hookable, I needed to do a dirty hack (overriding the GET.it parameter that is inspected by ProcessPageView::getPage()). I suggest making ProcessPageView::getPage() hookable and pass the arguments for the page look-up via method arguments instead of inspecting the GET scope within the method.
-
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 ( http://stackoverflow.com/questions/16569841/reloading-the-page-gives-wrong-get-request-with-angularjs-html5-mode/16570533#16570533 ), 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
-
I downloaded an existing processwire project to my mac, modified it a bit, and tried to upload it to a new "GoDaddy" server. The home page is loaded fine, and links to pages on that server that doesn't use the processwire system also works, but all the links that use the processwire system leads to "404 not found" error. No matter if try to get to them as links, or to type the address manually. It's like the server doesn't recognise that "www.MySite/newPage" should look for the "newPage" in the processwire directory, and it's trying to find a file names "newPage", in the root directory, that obviously doesn't exist. (Another point - running the project on MAMP server on my mac works fine). Any suggestions? Thanks.
-
Hello all, Hope you all are enjoying your weekend. Recently I shifted all my projects to Amazon's web service running a default ubuntu installation. We got almost everything working, some Drupal installations & Laravel etc. Even Processwire got installed correctly but it's just showing home page and nothing else. For example, I've a task management system that I use for personal projects management. It was working fine on my old hosting but on AWS, it's not showing me any pages except for static home page. If I try to access any virtual page or even the admin panel, it just shows me blank page with default HTML. I tried re-installing & fresh installations as well but it's still not working. Is there any specific change I need to make in HTACCESS? Thanks for your help.
- 3 replies
-
- aws
- processwire
-
(and 1 more)
Tagged with:
-
Hi, So I'm just getting started with using Processwire(PW) and I really like it so far. I've also recently started using AngularJS and loving it. Now i'm trying to setup angular routing to work with PW but not having much luck. I've google around etc and tried following the following post https://processwire.com/talk/topic/6281-angularjs-routing-with-processwire/?hl=%2Bangular+%2Brouting but still can't get it to work. I have a simple site setup for a portfolio, Home/About/Work/Contact I would love to have angular route all the other pages into the homepage. At the moment it just goes to the no-found url. If anyone could give me some tips that would be awesome.
-
Ahoi, pros! Currently I've to create some frontend related user profiles. However I stuck at the routing part. All users are a child of a `users`-page and their url's look like this: http://localhost/projects/ca/users/foo/ ...I've to accomplish a url-structure like the following, so I tried redirect all these request to this: http://localhost/projects/ca/foo/ Using .htaccess doesn't work for me in this case: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /projects/ca/ RewriteRule ^users/(.*)$ $1 </IfModule> Any ideas how to get this to work, maybe without .htaccess?
-
EDIT I got it working by adding a Rewrite rule to htaccess to specify the correct root. I wonder what changed in Windows 8 making this necessary It seems that I am having some issues with ProcessWire when running locally on a WAMP environment (specifically Windows 8). I had a working Windows 7 AMP environment and ProcessWire apps were working with ease. After updating to Windows 8, Apache seemed to be throwing 403s all over the place. It turned out WIndows 8 uses IPv6 primarily so ::1 references needed to be added to the apache conf file in addition to 127.0.0.1 references. After this change, all of my other local sites (WordPress, Drupal, Joomla, etc) started working again. However, my ProcessWire apps are still seeing issues. Basically I can navigate to and load the index page, but every other sub page results in a 403 (or 404 if I remove all Apache deny rules). I'm guessing something is off in ProcessWire's routing? Anyone have any insight on how pages are being served up and if there's a way to fix this? tl;dr Running Windows 8 AMP environment and ProcessWire is not serving up pages correctly
-
Hi there, I was just reading through the forum and anticipated, that I'll need something like this sooner or later, so I'm already asking: is there already some easy way to get Wordpress-style URLs (including the date) working for a subbranch of the tree? This should solve use cases like if i have a tree like this with the corresponding URLs: blog -> /blog my-article -> /blog/2012/12/24/my-article my-older-article -> /blog/2012/12/19/my-older-article ...and so on. It would also be nice to have options to format the URL with all the standard "Structure tags" the Wordpress has: year monthnum day hour minute second category author post_id postname I see that this is not too hard to do in your templates with URL segments but I'd prefer to have a handy module for this. Didn't have any time to really investigate into this already, just want to get some feedback on the idea: do you like/need this, is there already something solving this or a similiar featureset? Greetings, Marc