Leaderboard
Popular Content
Showing content with the highest reputation on 01/27/2014 in all areas
-
team_name=$page I always match the field against the object instead of the id.4 points
-
Well you could do that by using render in your template: echo $referencedPage->render();3 points
-
Hi IntegralHack, Welcome to the forums (it seems you've been using PW for a bit already?)... Your question has two parts: 1. Redirect to another page 2. Use Page Reference Field to select the page to redirect to... For (1), similar question was asked a couple of hours ago (incidentally)..so, I'll just point you to that thread.... http://processwire.com/talk/topic/5413-setting-the-homepage/ For (2), you will just need to tell PW in your template file to redirect to the page selected in the reference field....Does this make sense or you need some code to look at? Similar question answered today here http://processwire.com/talk/topic/5414-selector-find-page-reference-help/ EDIT: Added example code... OK, just in case/for the next guy..... $session->redirect($page->singlePageReferenceField->url); ....where singlePageReferenceField is your, uh,...self-explanatory ;-) Also, note that you can use normal PW selectors to specify the page to redirect from (e.g. if page ID is 123, redirect to.....) in case you want to be more specific [e.g. in cases where a template is used by several pages and you only want to redirect from a specific page(s) and not others...Hope this makes sense...2 points
-
Actually $page does resolve to the id here anyway so no difference.2 points
-
Hi PeterDK & welcome to the forums. When reading this, a question comes to my mind: Did you know ProcessWires built in Multi-Language-Support? Especially at first, how you can use Multi-Language-Urls and the Multi-Language-Fields? So, it may be you need to use the hirarchy like you have shown in your post, but I first want to ask if it could be a better solution to use the built in Multi-Language-Tools. If you need to go with your structure like shown above, you may use $session->redirect($url); in your home template. To redirect to nl/overzicht/ $session->redirect('/nl/overzicht/'); You can find these and many other at the CheatSheet. (You have to click 'advanced' at the top right to see more methods/properties) ------ EDIT: Generic url with redirect, like Kongondo has shown just a few seconds before my post, is a better solution! BTW: congrats to your 1.000 post Kongondo2 points
-
Hi PeterDK!, Welcome to ProcessWire and the forums! Nice to have you. OK, to your question. To redirect to the first child of a parent page, you can add the following code to the template file of the template of the landing page (in your case "root" and "en"): This code first checks to see if the landing page has children. If it does, it redirects to the first child's URL if($page->numChildren) $session->redirect($page->child()->url); OR This code directly redirects to the first child of the landing page (i.e. the parent page) without checking if there is a child first...the idea being if you wanted to redirect, you must have checked that there is a child to redirect to! $session->redirect($page->children->first()->url); These code are from the threads below. There are other ways to redirect to a particular child; Please read the threads: http://processwire.com/talk/topic/15-how-do-i-create-a-page-that-redirects-to-its-first-child/ http://processwire.com/talk/topic/2561-hide-landing-page-keeping-children-visible/ By the way, there could be other (better?) ways to organise your multilingual site rather than using a redirect on the homepage to nl. Feel free to Google our forums (e.g. multilingual site:processwire.com/talk OR EVEN blah blah site:processwire.com). Others may chip in. <i-digress>This is post #1000 for me!!!</i-digress>2 points
-
Adrian wrote a wonderfull module for that http://modules.processwire.com/modules/process-get-video-thumbs/ Side benefit: you can search pages with video's2 points
-
This is a very simple module that I put together for @Zahari Majini from a PM request. It allows you to enter a URL to a YouTube or Vimeo video in a specified field and when you save the page, it will grab thumbnails for the video and add them to a specified images field. Check the module configuration options for: the field(s) to search for videos name of the video images field which thumbnail(s) you want grabbed whether to grab the first available or all available thumbnails based on those that you list As always, an feedback for improvements is very welcome! Modules Directory: http://modules.processwire.com/modules/process-get-video-thumbs/ Github: https://github.com/adrianbj/GetVideoThumbs1 point
-
jQuery DataTables 1.9.4 This module adds the great jQuery DataTables plugin for use in ProcessWire. You can load the module in the admin from any of your module using: $this->modules->JqueryDataTables; This will load the module and add CSS and Javascript from DataTables. This mostly would be used by a custom admin Process module. Note: Loading this module will just attach the necessary files to the admin. To use it you would need to add your own jQuery scripts and init the DataTables with something like. $("#mytable").dataTable(settings); For more informations on the DataTables options and API refer to http://datatables.net/ Download: http://modules.processwire.com/modules/jquery-data-tables/ https://github.com/somatonic/JqueryDataTables I included only the necessary files, and removed examples and docs from the package. NOTE: To avoid confusion, THIS module has nothing to do with my ProcessDataTable module for ProcessWire! ProcessDataTable was a proof of concept integrating it in a admin page. It included the jQuery DataTables plugin, but unfortunately it may wasn't a good way to. JqueryDataTables is a special js module like Fancybox. It is a "integration" of the jquery plugin for developers to use datatables in their modules. It won't be loaded unless you do so. An example would be the ModulesManager. They can coexist if you will.1 point
-
@Ryan: if you need a list with the names of possible timezones: TimeZoneListen.zip1 point
-
Aaaah...I knew there was a catch...Yes, redirect will take you to another URL... There's various ways to get round that. 1. Use render()....I gotta run...I'll explain this later if someone else doesn't or you don't look it up first ;-) - render the whole page being referenced.. 2. $pages->get() [if only interested in a particular field in the page selected via the page reference... EDIT: In addition to the code example by Adrian below Examples in the wiki: http://wiki.processwire.com/index.php/Including_a_page_in_another_page Good to know: http://processwire.com/talk/topic/4367-using-page-renderoptions-and-template-cache/1 point
-
....That's why "if" is your good friend...if (teamHasplayers) {echo "bazinga!"}....1 point
-
<qoute>Please add this post to the wall of shame</qoute> Thats is only for people/questions who/that deserve it. This one I will take it off, if I see it there.1 point
-
1 point
-
1 point
-
1 point
-
Hanna Code doesn't actually execute from the DB. It writes each Hanna code to a file in /site/assets/cache/HannaCode/ and then uses the DB copy of the code to compare against the one on the file system, to make sure something hasn't changed the one on the file system. It executes the PHP code from a file in order to ensure it is as fast as possible (avoiding eval) and in the same context as a template file. That's what it does behind the scenes, but Soma's tip is just as useful either way, as Hanna Code wouldn't let you edit its own PHP files directly.1 point
-
Actually, on the topic of the default look. I personally quite look the futura color scheme, and I don't mind the warm (your current default), but I wonder if "modern" should be the default since it most closely matches the color scheme of the PW website. So, while the website looks as it does, I think that "modern" would be my vote for default "color set" and for the installation routine. Anyone else have a preference?1 point
-
I seem to have become hooked on Bastille the past few months: https://www.youtube.com/watch?v=F90Cw4l-8NY Also love this cover: https://www.youtube.com/watch?v=ZCTDKLjdok41 point
-
Damn Joss you scared my dog away! Let's see, in admin.php if($user->hasRole("dumb")) { $config->styles->add($config->urls->templates . "styles/dumb.css"); }1 point
-
Nice one Ryan Now all we need is to be able to select admin theme based on Role, so for some of my authors I can install one with REALLY BIG INSTRUCTIONS!!!1 point
-
This admin theme has been converted over to be an AdminTheme module (a new module type just added to the PW core). If you grab the latest dev, you can now delete your /site/templates-admin/, as it will switch to using this admin theme as a module. The color theme is now selectable from the module settings screen. It will automatically install when you upgrade to the latest dev and login to your admin. But if you want to revert back to another admin theme in /site/templates-admin/ (or even the old admin theme in /wire/templates-admin/), then all you need to do is uninstall the AdminThemeDefault module. There are several advantages to having admin themes be modules. I'll get into those later, but one is that you can have multiple admin themes installed. When you've got more than 1 installed, the User Profile screen will let each user select which admin theme they want. It's easy to convert any existing admin theme to a module: 1. Move all the admin theme files to /site/modules/AdminThemeSomething/ - replacing "Something" with whatever the name of the admin theme is. 2. Create a file in that directory called AdminThemeSomething.module (again, replacing "Something") and place the following in it (substituting for your own info): <?php class AdminThemeSomething extends AdminTheme implements Module { public static function getModuleInfo() { return array( 'title' => 'Some Admin Theme', 'version' => 1, 'summary' => "Enjoy this nice admin theme", 'autoload' => "template=admin" ); } } 3. Install the module from your admin, the same way you would install any other module. That's it! If you have the dev admin theme (or another) installed in /site/templates-admin/ and no longer need it, feel free to remove that directory. But don't remove the one in /wire/templates-admin/.1 point
-
Actually, you can do this on the dev branch. Lets assume that cities are children of countries and that is reflected in your page structure (i.e. /countries/france/paris/). Create your 2 page fields (country and city), and configure 'country' as a single page field with "parent" set to "/countries/". Next, for the "city" field configuration, use the "Custom selector to find selectable pages", present on the "input" tab. In that field, enter "parent=page.country". Save and try it out. This works with select, selectMultiple and asmSelect fields (and possibly others), though not yet with checkboxes, radios or PageListSelect.1 point
-
Resurrecting this slightly, but I did something along these lines just now with help from this thread (actually approached it netcarver's suggested way from the first post). It's one where I wanted to skip the first page of adding a name (for events in a calendar) but didn't want to use a repeater - which would achieve the same, but I wanted separate pages. Code as follows: In init function: $this->pages->addHookBefore('ProcessPageAdd::execute', $this, 'generateName'); The function that does the work (specific to my case): public function generateName() { if ($this->input->get->parent_id == 1019) { // 1019 = some page where we want to auto-generate child page names $page = new Page(); $page->parent = $this->input->get->parent_id; $page->name = $this->pages->get($this->input->get->parent_id)->count()+1; $page->template = 'child-template-name'; $page->addStatus(Page::statusUnpublished); $page->save(); $this->session->redirect("../edit/?id=$page"); } } So it checks we're creating a page under a certain parent, sets the right template, creates a page using an integer as the name based on the count of pages under the parent page and then takes you to the edit form for that page. The beauty of it is that since there has been no title entered so far, the user has to fill out the page fields - well title at least - to continue. So why did I do something so convoluted here? Because for what I'm using the title field for I needed to allow duplicate titles, so different names is key to this. The individual pages themselves will never be visited - they're just being pulled into a table into the parent page. Of course I could have used repeaters, but on this occasion I didn't want to. I think that with a little work, and the addition of multiple config lines like in my ProcessEmailToPage module you could expand this to monitor certain parent pages, hook into new page creation and create the page with a specific child template nice and neatly instead of hardcoding it as above. When I get time I might just do that... which might not be any time soon For now the above code works though for anyone wanting to adapt it to do something similar.1 point