Jump to content

LAPS

Members
  • Posts

    258
  • Joined

  • Last visited

Everything posted by LAPS

  1. Hi, I bookmarked a number of custom Listers (path: /admin/page/lister) and I have some doubts on how to use them. In particular, I would like to link a custom Lister page in front-end content. I could make this by inserting a link within the body field (CKEditor) of a my page and using the URL of the Lister (e.g. /admin/page/lister/?bookmark=1514677991) so to render a linked text in the front-end. My doubt: is the use of that URL the right way for linking text to a Lister? I also would like to access the title data of the custom Lister in order to output the title as linked text in the front-end. How can I do that (note: I am using the Hanna Code module for my body field)? I have not found the relevant documentation that serves my case.
  2. It did not work, also by using Pages('template=user')::saveReady.
  3. @Soma I think either "cache" nor "addHookProperty" is not the solution in my case. I would like to store the full name in the title. Both "cache" and "addHookProperty" seem do not make that. @bernhard I agree on using 'addHookAfter' to be sure that the method itself does not overwrite the value again. BTW: I used Tracy with the above code but it didn't debug $event: However, if I use Tracy this way wire()->addHookBefore('Pages::saveReady', function($event) { bd($event); }); it debugs $event:
  4. I also tried to use your hint without success: wire()->addHookBefore('Page(template=user)::changed(0:last_name, 1:first_name)', function($event) { $page = $event->arguments('page'); $page->title = $page->last_name . " " . $page->first_name; });
  5. Among the many tests, I tried to use the conditional hook 'Page(template=user)::saveReady' without success: wire()->addHookBefore('Page(template=user)::saveReady', function($event) { $page = $event->arguments('page'); $page->title = $page->last_name . " " . $page->first_name; }); The linked documentation refers to the 'Page::changed' hook. Are conditional hooks only available for 'Page::changed' hooks?
  6. By putting the code in the '/site/ready.php' file it does work. Since I need to use the hook only for my specific 'user' template pages, I could use an 'if' statement something like this: wire()->addHookBefore('Pages::saveReady', function($event) { $page = $event->arguments('page'); if ($page->template->name == 'user') { $page->title = $page->last_name . $page->first_name; } }); However, is there a way or a best practice to state the hook code somewhere so that I can explicitly indicate that the hook just run (and load) for the 'user' template, avoiding to use 'if' statements? Maybe, I want my hook to apply to all instances of a class but I am not sure how to proceed with coding and statement/file positioning. Thank you, I will give a look at Tracy debugger.
  7. I am using PW version 3 and I would like to define a hook for a my specific template applicable to both the site (front-end) and the ProcessWire admin. My template is named 'user' and has 'last_name' and 'first_name' input fields. The hook should set the 'title' to 'last_name' + 'first_name' on creating and updating data. I tried the following, without success: In the admin panel, 'Edit Template: user' > 'Files' tab, I set 'Prepend File' to 'hooks/user_int.php'. In the 'hooks/user_int.php' file I wrote: wire()->addHookBefore('Pages::saveReady', function($event) { $page = $event->arguments('page'); $page->title = $page->last_name . " " . $page->first_name; }); However, when I create/edit and save a 'user' page it does not seem to work: 'title' is not set to 'last_name' + 'first_name'. What am I doing wrong? What should I do?
  8. An easier workflow may be possible through the development of a specific PW “Pro-module” or better integration of existing PW modules (e.g. Profields-FormBuilder fields compatibility) to supporting the front-end development, maybe making PW to be used also as a sort of markup generator. I am discussing this here.
  9. I have been using PW for a few days and I can say that it is a powerful tool for creating web sites, web applications, services, etc. However, doing research on the web, it seems to me that PW has a gap especially with regard to front-end forms development. I refer to the possibility of quickly and easily implementing forms to be used in the front-end to allow users to create new pages. In particular, I would like to allow registered/authenticated users to submit forms on the front-end as I (superuser) can make in the back-end of PW, comprising the bundle of input fields features such as for Multiplier, Repeater and Page. Although I tried to address this gap buying the FormBuilder module and later ProFields, the implementation of front-end forms seems to be still a "hard job" because, if I understand correctly, and since I cannot use almost all of the ProFields fields with FormBuilder, I have to write API-based code to get some sort of "legacy solution" e.g. see Front-end tips, tools and general development. From a developer's point of view, front-end forms development and implementation in PW should instead be as easy and linear as using the FormBuilder module, designed specifically to work for the PW front-end. Said that, and with respect to everything of powerful that has already been done, my question is: why does front-end forms development not seem to be reasonably addressed at the core of PW?
  10. Hi all, I am new to PW and I created my fields, template and page. Also, I successfully installed the LOGIN/REGISTER/PROFILE module. Now I would like to allow a registered user to post new content (i.e. database table records)... "related to"/"for" the page so that I can display a list of records later. How should I make that (e.g. through a form)? There is a tutorial for this?
×
×
  • Create New...