-
Posts
908 -
Joined
-
Last visited
-
Days Won
1
Posts posted by PWaddict
-
-
25 minutes ago, adrian said:
Are you using a JS framework?
You need to make sure the X-Requested-With header is sent so that PHP (and therefore Tracy) can recognize it as an AJAX call. jQuery does this by default, but other frameworks may not, eg Angular.
In pure/vanilla JS, you can do:
xmlhttp.setRequestHeader("X-Requested-With", "XMLHttpRequest");
In Angular you can do:
$http.defaults.headers.common["X-Requested-With"] = "XMLHttpRequest";
I'm using JQuery and on frontend I can see the header X-Requested-With: XMLHttpRequest but there is no AJAX bar.
On backend there is no X-Requested-With: XMLHttpRequest header but I can see the AJAX bar. -
2 minutes ago, adrian said:
The AJAX bar displays automatically when there has been an AJAX request - you can see this behavior when viewing the Page Tree in the PW admin, or triggering sub items from any of the admin menus, or any AJAX calls you make on the frontend.
You should also see "Redirect" bars when there has been a redirect call.
Do you not see any of these?
Ah yes only on backend I can see the AJAX one. On frontend I can't see it even though the entire site is based on AJAX.
-
3 minutes ago, adrian said:
Sure - just check out the RequestInfo panel on the AJAX bar and open up the Input POST section.
Does that get you what you want?
There are more than 1 bars??? How can I view the AJAX one?
-
@adrian Is it possible to view the values submitted on an ajax form and how?
-
41 minutes ago, adrian said:
I don't know - you tell me ?
I just took a very quick look and the basic functionality seems ok. Could you point me to what you are having issues with?
I'm still using the 3.0.110. I've read about the changes on page names on 3.0.111 and that's why I asked if it affects the module.
-
@adrian Does the PW 3.0.111 affects the module?
-
The following hook should do what you want. It's based on old @Soma's post. All you have to is to edit $myslug with your random hash generator.
$wire->addHookBefore("Pages::saveReady", function(HookEvent $event) { $page = $event->arguments[0]; if ($page->template->name != 'news-article') return; foreach ($this->languages as $lang) { $lname = $lang->isDefault() ? '' : $lang->id; $default = $this->languages->get("default"); $myslug = '-myslug'; if ($page->title->getLanguageValue($lang)) { $page->set("name$lname", $page->title->getLanguageValue($lang) . $myslug); } else { $page->set("name$lname", $page->title->getLanguageValue($default) . $myslug); } } });
- 2
-
@kixe The 175 line of the module is causing the issue:
if (wire('fields')->get($format) && wire('fields')->get($format)->type instanceof FieldtypeOptions) $value = $page->get($format)->get('value|title');
I had to change this to this in order to get the title of the options field:
if (wire('fields')->get($format) && wire('fields')->get($format)->type instanceof FieldtypeOptions) $value = $page->get($format)->title;
Additional languages for the options field are ignored cause I'm only getting the default one for all page names.
Please check it out and update the module. Thanks.
-
@kixe I want to use an Options field as part of the pagename but I don't get anything. On the Name format for children I tried with: title my_options_field and with title my_options_field.title but I only get the pagename from the title field.
- 1
-
In your selector add sort=sort.
- 4
-
Here is how I did it:
$wire->addHookAfter("Pages::save", function(HookEvent $event) { $page = $event->arguments[0]; if($page->template->name != 'my-template') return; $admin_page_name = wire("pages")->get(2)->name; $repeater_id = wire("fields")->get('my_repeater_field')->id; $empty_items = $pages->find("template=repeater_my_repeater_field, my_text_field='', parent=/{$admin_page_name}/repeaters/for-field-{$repeater_id}/for-page-{$page->id}/, include=all"); if(count($empty_items)) { foreach($empty_items as $empty_item) { $page->of(false); $page->my_repeater_field->remove($empty_item); $page->save(); } }
- 3
-
I would like to auto remove repeater items if a text field inside repeater item is empty.
The below code placed inside the template removes the specific repeater items when someone visits the page. How can make it work in a Hook when the editor saves the page on backend?
$admin_page_name = $pages->get(2)->name; $repeater_id = $fields->get('my_repeater_field')->id; $empty_items = $pages->find("template=repeater_my_repeater_field, my_text_field='', parent=/{$admin_page_name}/repeaters/for-field-{$repeater_id}/for-page-{$page->id}/, include=all"); foreach($empty_items as $empty_item) { $page->of(false); $page->my_repeater_field->remove($empty_item); $page->save(); }
-
Has anyone figured this out? I really need this hook. -
I've never output repeater content outside from their pages so maybe I'm not the right guy to help you. Until someone else can reply you should check the Repeater demonstration page on the part "Finding pages by repeater value (using selectors)".
-
Try the below but on the template enter the name of the repeater template. If you go to "Setup > Templates > Filters > Show system templates? > Yes" you'll find that your repeater field has a template like this: repeater_your_event_repeater:
$upcoming_dates = $pages->find("template=repeater_your_event_repeater, agenda_datum>=$today, sort=agenda_datum, limit=3");
-
10 minutes ago, tooth-paste said:
@PWaddict: Thank you, but can I place the code on a different page(homepage)? I tried the following code but it does not work.
Sorry my mistake. The selector code if placed on another page must be $pages->find. Try this:
$upcoming_dates = $pages->find("template=your_event_template, agenda_datum>=$today, sort=agenda_datum, limit=3");
-
@tooth-paste Of course just add a limit on your selector like this:
$upcoming_dates = $page->agendaitem->find("agenda_datum>=$today, sort=agenda_datum, limit=3");
-
2 hours ago, wbmnfktr said:
I totally agree with that but pages in pages under pages (repeaters) is something different. So plain pages are always more easily to control.
I think it depends on the content.
-
@wbmnfktr Repeater items are actually pages too.
@tooth-paste Here is how you can do it:
<?php if(count($page->event_repeater)) { $today = strtotime("today"); $upcoming_dates = $page->event_repeater->find("event_date>=$today, sort=event_date"); if(count($upcoming_dates)) { foreach($upcoming_dates as $upcoming_date) { ?> <div>...</div> <?php } } } ?>
- 2
-
Is there any difference between these? Aren't they doing exactly the same thing?
if($page->template == 'admin') return; if($page->template->name == 'admin') return;
-
To easily add rel="next" and rel="prev" tags for pagination in head section insert the following hook to your site/ready.php:
$wire->addHookAfter('Page::render', function(HookEvent $event) { $page = $event->object; if($page->template == 'admin') return; $tags = ''; $config = wire('config'); if($config->urls->httpNext) { $tags .= "<link rel='next' href='{$config->urls->httpNext}'>"; } if($config->urls->httpPrev) { $tags .= "<link rel='prev' href='{$config->urls->httpPrev}'>"; } $event->return = str_replace("</head>", $tags . "</head>", $event->return); });
- 7
- 2
-
Try to install a fresh copy of PW to the server you have the issue and during installation PW will let you know if your server is properly configured.
- 1
- 1
-
When you moved the files on the server did you also moved the folders cache, logs & sessions from site/assets/ ? If yes then I suggest you to DELETE those folders. This could be the problem.
-
The Inputfield Dependencies page doesn't say anything about the published status so I guess it isn't possible. You might be able to do what you want with a hook.
- 1
Tracy Debugger
in Tracy Debugger
Posted
I haven't changed anything on module settings and yes it's enabled since I already can see the normal bar.