Jump to content

cb2004

Members
  • Posts

    578
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by cb2004

  1. Cheers LostKobrakai. Still no joy with this though.
  2. This is in the ready.php file, I think it would work with no problems on the frontend.
  3. Cheers BitPoet, but there is an error after adding: Method Pages::setAndSave does not exist or is not callable in this context
  4. I am having a bit of a brain ache with this one. Can anybody point me in the right direction. At the moment I just want to get the field text_1 populated with the value test and then I should be good to go. Cheers. <?php $pages->addHookAfter("added", function($event) { $page = $event->object; if($page->template->id == 46) { $page->text_1 = "test"; } });
  5. VPS does look great, but it is a page selector. My idea was an image/file selector outside of the RTE. The functionality to add images/files from other pages is an easy process and available in the RTE, but not in an image/file field.
  6. Seems like this would be a nice addition. I have also just come up with a need for this for files as well. The file already exists on another page but I can only select the file from the RTE (but I want to add some styling and a font awesome icon), but I want this to be selectable from a field.
  7. Yeah, I have been caught out with classes starting with digits a few times. I will look into adding a data tag as you suggest. Cheers.
  8. Yes I thought that as well. So I am giving each option in the staff dropdown classes: <option value="Staff member" class="1041 1045 1046 1048">Staff member</option> Then if the service dropdown selected is value="1041", only those staff members will be selected. Just got to work on the jQuery and then all done.
  9. So in my form I am selecting the services: foreach ($pages->get(1040)->children as $child) { $service .= '<option value="' . $child->id . '">' . $child->title . '</option>'; } This is then returning a nice set of options to interrogate from ID: <select name="service" id="service"> <option value="1041">Service 1</option> <option value="1042">Service 2</option> </select> So I am thinking next step is to put a PHP file on the server which would do a $pages->find("template=service, page_staff=VALUE") using Ajax and return the results with the staff name?
  10. Can anybody offer up any tips for this? Basically on a contact form there are certain services, and certain staff members are assigned to those services. When a service is selected in a dropdown, I only want the staff members assigned to that service to be displayed in another dropdown. Guessing it is venturing into Ajax which I have not done with ProcessWire yet. Cheers.
  11. ProDrafts should be coming soon which is a commercial module. But it looks awesome.
  12. Think I found the answer. The parent template can hold a name format for children, I just put in title as instructed and it begins as untitled. Man I do love ProcessWire.
  13. When adding a page you need to enter a title, the name is then auto-populated from this. I am building a system where quotes are created, I would then create an invoice. The quote would contain a project name, the invoice title would need to be the same as the project name in the quote. Is this linking possible at this step, or am I going to have to hook into it after save?
  14. Need to dive into this soon. But I will need to bring over featured images and anything from Yoast, so I will report my findings once looking at the structure.
  15. Should anybody need this: $pages->addHookAfter("ProcessPageEdit::buildForm", function(HookEvent $event) { $page = $event->object->getPage(); $form = $event->return; if ($page->template->id == 44 && $page->parent->id != 1020) { $fieldset = $form->find("id=Inputfield_fieldset_tab_2")->first(); $form->remove($fieldset); $event->object->removeTab("Inputfield_fieldset_tab_2"); } }); Just replace the $page->template->id with the id of your template, and the $page->parent->id to what you want (or something similar). Finally replace fieldset_tab_2 with the name of your field.
  16. I have a repeater, which with the use of a hook I can stop that from displaying from certain pages: <?php $wire->addHookAfter("ProcessPageEdit::buildForm", function(HookEvent $event) { $process = $event->object; $form = $event->return; $page = $process->getPage(); if ($page->template->id == 44 && $page->parent->id != 1020 && $page->parent->id != 1021) { $form->remove($form->getChildByName("repeater_partners")); } }); My repeater is in a fieldset tab, so on any pages where the repeater should not be displayed, the fieldset tab is (the repeater is not). Any way to remove this within the above? Cheers.
  17. For me this is great news. All my sites going forward will only be tested in IE11. If there is a problem with anything below that, the end of life can be highlighted to the client, and a fix will cost extra (unless it is simple of course). Gone are the days I have to spend time and implement fixes for crap browsers for no extra money.
  18. Do you have any cache settings on the template?
  19. Yeah I jumped into the blog post shortly after and came up with the following: <?php $pages->addHookAfter("ProcessPageEdit::buildForm", function($event) { $form = $event->return; $page = $event->object; if ($page->template->id == 47 && $page->numChildren == 0) { $form->remove($form->getChildByName("rte_basic_2")); } });
  20. It works fine, cheers (edited my above post). Where can I read up more about hooks?
  21. Cheers BernhardB, no joy I am afraid though. Edit: scrap that, I enabled debug mode and then all was fine. Thanks.
  22. So if I am editing a page and it has children, can I display a text box? Cheers.
  23. Yes, without the leading slash.
  24. I am trying to implement Jumplinks on a new site but not sure what is happening, the 404 template is not even being fired. I dont think this is a bug with Jumplinks or ProcessWire to be honest, but wondering if any light could be shed on this. If I go to /example.php, I get a page which just says 'File not found.' and nothing else. If I go to /example then the 404 template is fired. I have setup Jumplinks to try and change /example.php to go to /new-example but it is not kicking in. Server configuration do you think?
×
×
  • Create New...