Search the Community
Showing results for tags 'pages'.
-
The Page Hit Counter module for ProcessWire implements a simple page view counter in backend. Page views of visitors are automatically tracked on defined templates, with monitoring of multiple page views. This gives you a quick overview of how many visitors have read a news or a blog post, for example, without first having to open complex tools such as Google Analytics. This module quickly provides simple information, e.g. for editors. Or, for example, to sort certain news by most page views. For example for "Trending Topics". Works with ProCache and AdBlockers. With a lightweight tracking code of only ~320 bytes (gzipped). And no code changes necessary! In addition GDPR compliant, since no personal data or IP addresses are stored. Only session cookies are stored without information. In addition, there are some options, for example filtering IP addresses (for CronJobs) and filtering bots, spiders and crawlers. You can also configure the lifetime of the session cookies. Repeated page views are not counted during this period. It is also possible to exclude certain roles from tracking. For example, logged in editors who work on a page are not counted as page views. Sort by hits and access page views (hit value) Each trackable template has an additional field called phits. For example, you want to output all news sorted by the number of page views. // It is assumed that the template, e.g. with the name "news", has been configured for tracking. $news = $pages->find("template=news, sort=-phits"); To output the page views of a tracked page, use: echo $page->phits; Example: Reset counter per API $modules->get("PageHitCounter")->resetPageViews("template=whatever", false); Example: Tracking a page hit via API and jQuery If you want to track a template that does not represent a full page to automatically inject a tracking script, you can define allowed API templates in the module that you can track. Below is an example of how you can track a click on news tag using jQuery. This will allow you to find out which keywords are clicked the most. For example, you can sort and display a tag cloud by the number of hits. Suppose your keywords have the template "news_tag". The template "news_tag" was also configured in the Page Hit Counter Module as a trackable API template. Example PHP output of keywords / tags: // Required: the data attribute "data-pid" with the ID of the template to be tracked. echo $pages->find("template=news_tag, sort=-phits")->each("<a href='{url}' class='news_tag' data-pid='{id}'>{title}</a>"); Example Tracking Script with jQuery: /** * Required: Data attribute "data-pid" with the ID of the news tag template * Required: Send the POST request to the URL "location.pathname.replace(/\/?$/, '/') + 'phcv1'" * Required: The POST parameter "pid" with the ID of the template */ $(function(){ if($('a.news_tag').length > 0) { $('a.news_tag').each(function(){ var tPID = $(this).data("pid"); if(tPID) { $(this).on("click", function(){ $.post(location.pathname.replace(/\/?$/, '/') + 'phcv1', {pid: tPID}); }); } }); } }); So simply every click on a tag is counted. Including all checks as for automatic tracking. Like Bot Filtering, Session Lifetime, etc. Notice: Tracking with URL segments If the option "Allow URL Segments" is activated on a template, the hits are only counted if the base URL of the page is called. If you want the hit to be counted even when a segment is requested, you MUST configure the segments in the template configuration. How to do this can be found here. If you use dynamic segments, configure them as RegEx. There is currently no other option. The problem is that the Page Hit Counter hooked into the PageNotFound process. If URL segments are allowed but not defined, a 404 is never triggered. This means that the Page Hit Counter cannot be called. New since 2.0.0: Ignore URL segments If a template has URL segments configured, each hit on a different segment is counted as a new hit. Enable "Ignore URL segments" so that dynamic segments are not counted individually on the base template / page. New since 2.0.0: Use cookieless tracking (Experimental) Enable this option to not use individual cookies for tracking or if you have many different pages you want to track. The limit for cookies is 50 per domain for all cookies on the page. If the option is enabled, PHP session storage is used. Downside: you can't set the lifetime higher than configured in your PHP.ini and the session will be terminated as soon as the browser is closed. Upgrade note for 2.0.0 from previous versions! Version 2.0.0 requires an update in the database schema, so that additionally the date of the last access / hit on the page can be displayed ($page->lastPageHit). To make this possible, you have to do the update via the upgrade module, upload the ZIP itself and do an update directly via the backend AND DO A MODULE REFRESH DIRECTLY AFTER UPLOAD/UPDATE. If you do not do this, you will get an error that a column is missing in the database table. _______________________________________________________ Background: This module is the result of a customer requirement, where the editors are overwhelmed with analytics or no tracking tools were allowed to be used. However, a way had to be found to at least count page views in a simple form for evaluations. Furthermore, by using ProCache, a way had to be found to count views of a page without clearing the cache. _______________________________________________________ Pros Automatic Page View Tracking Lightweight tracking code, only ~320 bytes (gzipped) No code or frontend changes necessary Works with ProCache! Even if no PHP is executed on the cached page, the tracking works Works with browser AdBlockers No cache triggers (for example, ProCache) are triggered. The cache remains persistent GDPR compliant, session-based cookie only, no personal information Filtering of IPs and bots possible Exclude certain roles from tracking Ability to reset Page Views Works with all admin themes Counter database is created as write-optimized InnoDB API to track events for templates that are not viewable No dependencies on libraries, pure VanillaJS (Automatic tracking script) Works in all modern browsers Pages are sortable by hits Cons Only for ProcessWire version 3.0.80 or higher (Requires wireCount()) Only for PHP version 5.6.x or higher No support for Internet Explorer <= version 9 (Because of XMLHttpRequest()) No historical data, just simple summation (Because of GDPR) Segment URLs can only be counted if the segments are defined Planned Features / ToDos API access to hit values Since version 1.2.1 Possibility to sort the pages by hits (Request by @Zeka) Since version 1.2.0 Don't track logged in users with certain roles (Request by @wbmnfktr) Since version 1.1.0 Possibility to reset the counter for certain pages or templates (Request by @wbmnfktr) Since version 1.1.0 Better bot filter Since version 1.1.0 Disable session lifetime, don't store cookies to track every page view (Request by @matjazp) Since version 1.2.1 Option to hide the counter in the page tree (Request by @matjazp) Since version 1.2.1 Option to hide the counter in the page tree on certain templates Since version 1.2.1 API to track events for templates that are not viewable Since version 1.2.2 Cookieless tracking Since version 2.0.0 Show last hit Since version 2.0.0 Ignore URL segments (Request by @bernhard) Since version 2.0.0 Add hookable method after pageview was tracked (Request by @bernhard) Since version 2.0.0 Changelog 2.0.0 Feature request: Add hookable method after pageview was tracked (___pageViewTracked($pageID)) (Requested by @bernhard) Feature request: Ignore URL segments option (Requested by @bernhard) New: Cookieless tracking New: Show date of last hit Update: Botlist Enhancement: Documentation improvement 1.2.7 Feature request: make buildPageListHitCounter-Function public (Requested by @bernhard) 1.2.6 Bug-Fix: Set the counter of a cloned page to 0 Enhancement: The function for resetting counters is now available in the module as a public function to reset counters via own scripts on the API side (Request by @VeiJari) Enhancement: Documentation improvement API reset 1.2.5 Bug-Fix: When counting 404 hits, cookies are no longer set. The session lifetime is deactivated for the 404 page Enhancement: Documentation improvement regarding URL segments 1.2.4 Bug-Fix: Resetting the counters on system pages (e.g. 404) does not work (Reported by wbmnfktr) Bug-Fix: Tracking endpoint is logged as 404 if module "Jumplinks" is installed (Reported by wbmnfktr) Enhancement: Corrected few typos (Merged from Sergio #6 – THX!) 1.2.3 Bug-Fix: Tracking script triggers 404 if pages are configured without slash (#3) Reported by @maxf5 Enhancement: Reduction of the tracking script size if it's gzipped (~320 bytes) Enhancement: Documentation improvement Enhancement: Corrected few typos 1.2.2 New feature: API to track events for templates that are not viewable Enhancement: Documentation improvement 1.2.1 API access to hit values Use $page->phits Bug-Fix: No tracking on welcomepage (Reported by wbmnfktr; Thx to matjazp) Bug-Fix: Tracking script path on subfolders (Reported by matjazp) Bug-Fix: Tracking on pages with status "hidden" Enhancement: Change database engine to InnoDB for phits field Enhancement: Option to disable session lifetime set session lifetime to 0, no cookies Enhancement: Better installation check Enhancement: AJAX Request asyncron Enhancement: Reduction of the tracking script size by ~20% Enhancement: Option to hide the counter in the page tree You can output the counter with the field name "phits" Enhancement: Option to hide the counter in the page tree on certain templates Enhancement: Option for activate general IP validation Enhancement: Reduction of tracking overhead up to ~30ms Enhancement: Better bot list for detection 1.2.0 New feature: Sort pages by hits – New field phits Migrate old counter data to new field 1.1.0 New feature: Exclude tracking of certain roles New feature: Reset Page Views Better bot filter and detection 1.0.0 Initial release Notes By default, the page views are stored as INT in the database. This allows a maximum counter value of 4.2 billion views (4,294,967,295) per page. If you need more, change the type to BIGINT directly in the database. But I recommend to use Google Analytics or similar tools if you have such a large number of users. _______________________________________________________ Download GitHub: ProcessWire Page Hit Counter (Version 2.0.0) PW Module Directory: ProcessWire Page Hit Counter (Version 2.0.0) Install via ProcessWire (Classname): PageHitCounter _______________________________________________________ Update information If you have used version 1.2.1 from the DEV branch, please replace it completely with the new master version. Old stable version Download GitHub: ProcessWire Page Hit Counter (Version 1.2.7)
- 111 replies
-
- 22
-
- hitcounter
- tracking
- (and 4 more)
-
To explain my problem, I will show my usecase scenario first. I have the following page types: There is a page type 'Person', with parent type 'People' There is a page type 'Project' with parent type 'Projects' 'People' and 'Projects' are just containers/parent pages to 'Person' and 'Project' respectively. Every person can be associated with one or more projects, every project can have multiple people in charge. What I did is - I made it 'Person'-centric, meaning I added a field on 'Person' type page that helps you select projects (Multi Page reference field). I didn't do the same for 'Project' type as it seems like duplicating the effort. Result is when I edit a Person, I can see the projects associated and that is fine. What I want is when editing a Project to see what 'Person'(s) have that particular project in their admin page. I am talking about admin pages only, obviously this is much easier in frontend where I can do this via custom PHP code. Maybe there is a Processwire field that can display a result of page selector? Please advise on the above, I am open to alternative approaches to this problem as well. Thanks in advance!
-
Hi, Looking to create form elements on a page–some input with a colection of form inputs and the appropriate labels and variables for that input. I've used ProForms in the past and rolled out my own when creating simply one off forms, but I wonder if anyone has found a good way of allowing form creation on page editing so that clients can adhocly make and edit forms? Thanks
-
Hi, I need to populate a multi selection field with all the children of a template. How would you proceed? Thank you
-
Hi, I am currently using Processwire for a client project and am quite pleased with the ease of use and versatility. Unfortunately I came across a problem I am not able to solve: I have a multi-lang site where the home page path are as follows: www.example.com/ -> german (default) www.example.com/en/ -> english ... I build a language switcher that first gets the current page and then displays links for the page in all the different languages. <?php namespace ProcessWire; ?> <ul class="lang-switcher"> <?php $real_page = $pages->get($_SERVER['REQUEST_URI']); foreach ($languages as $language) { if (!$real_page->viewable($language)) { continue; } // echo <li>...</li> } ?> </ul> (I need to search for the real page because the language switcher is loaded inside of the menu which is an additional page/template which get loaded via echo $pages->get("title='Main menu'")->render(); . When using $page->localURL() I get the /main-menu page.) this works without problems for urls: www.example.com/ www.example.com/test www.example.com/en/test ... But not for: www.example.com/en/ I diagnosed that $pages->get("/en/") returns a NullPage instead of the english home page. Do you have any idea why this is and how to fix it. Thanks alot.
- 2 replies
-
- multi-language
- get
-
(and 1 more)
Tagged with:
-
Afternoon, I have a page setup with a repeater which has 40 or so items in. Each repeater item has around 6 fields. This is becoming a little unusable so I'd like to convert them to child pages of the current parent. Is there a way to do this (import/export maybe?) Many thanks Pete
-
BACKGROUND SEO matters and so hiding pages behind a "section" is not necessarily good - example: Current practice is to show the pages "Foo, Bar, Baz" in a section. https://www.example.com/resources/foo https://www.example.com/resources/bar https://www.example.com/resources/baz For SEO reasons, it's better to show the page at root level like so: https://www.example.com/foo https://www.example.com/bar https://www.example.com/baz PROBLEM: LACK OF ORGANIZATION WHEN ALL PAGES ARE PUBLISHED AT ROOT LEVEL This design is fully possible today. However, the root folder becomes disorganized when all pages are published in the root - and the pages tree structure is not of much use when all pages are published in the root. SOLUTION: VIRTUAL PAGES TO THE RESCUE As a publisher, when publishing many pages that have a root level url, I want to organize my pages below a Virtual Page (that doesn't have a url), so that pages are organized in a Pages Tree Structure (using "Virtual Pages"). What is a "Virtual Page"? Virtual Page can never have a name (Admin -> Page -> Settings -> Name). The Name field is simply blank The Name field is never used in the url for child pages. Virtual Page is a container used to organize other pages. Virtual Page is never shown in the front-end. Virtual Page is shown in the Editing interface only. Virtual Page might have a Template - but the template can only be used in the Admin interface. Virtual Page might have fields (Title, Summary, Text etc.) - but the contents cannot be shown online.
-
Hi, I created a Field Type: Page and I want to get a Dropdown where all Pages I have in my PW are listed. With custom Selectors it is possible to call Pages e.g. by template. But in my dropdown I cant select this Page. When I am trying to save I will get an error, that this Page is no valid selection. IMHO it depends on the rule of Parent Page that is selected. Are they any ways to get an Array of all Pages i have, without defining a parent page? Greeting from Nuremberg!
-
Hi! I want to make a small site, a one page site. And i have this idea about doing 2 to 3 diffrent template that i can load into the index / home page. I want to do this with an array so that i can keep creating more topics (with the template) id needed. <?php include('./head.inc'); // include header markup ?> <?php $children = $page->get('template=onecolmn|twocolumn, sort=sort'); foreach($children as $child) { include($child); } ?> <?php include('./foot.inc'); // include footer markup ?> As you can see i have to template wish i want to control from the backend. I know include does not work this way, put what is my other option to make an array that loads the whole page on an other pages.
-
Hi All, New user over at Processwire and have been rebuilding my site based on this CMS. I have been able to find so many answers through Google but I'm a little stuck on this one. I have my services page -> services categories -> category children. An example of those would be - domain -> services -> ppc -> management I also have a set of tags which have different names - services-tag -> grow-your-traffic Under these tags I would have multiple links to pages such as ppc, seo, social media and so on. A second example would be - services-tag -> convert-your-traffic Under here i would have multiple links to pages such as CRO Now the set of tags are not visible on-site as they are only created to give overview content to the main services categories. Using the categories and the tags I am looking to produce a layout such as (i have also attached an image as an example: Tag_1 headline Pull all services categories linking to Tag_1 Tag_1 snippet Tag_2 headline Pull all services categories linking to Tag_2 Tag_2 snippet So far I have this snippet which is pulling in the tag content but unable to get the posts to show under each of the tags. If i change the if and statement to "tags" instead of "tag" then all posts show under all tags. Where as i want it to show only the posts which are linked to that tag. <?php namespace ProcessWire; $tags = $pages->get("/categories-services/")->children(); // Gets the tags $posts = $pages->get("/services/")->children(); // Gets the services categories $link = $tags->ref_6; // Gets the tags and services categories link - under here you have pages_id (services cat id) and data (tags id) // Tag header and summary foreach($tags as $tag) { // This breaks down the tags into sections echo '<section id="services"> <div class="container"> <div class="row"> <h2 class="heading-1"><span>'. $tag->headline.'</span></h2> <p class="mb-5">'. $tag->summary.'</p> </div> <div class="row justify-content-around services">'; // Main services categories that link to the above tags if ($posts->id === $link->pages_id && $tag->id === $link->data){ foreach($posts as $service){ // This pulls in the services categories under the tag header. echo '<div class="card flex-card" id=""> <div class="card-img"> <a href="/'. $service->name.'" title="'. $service->name .'"> <img class="card-img-top" src="../assets/files/'. $service->id.'/'. $service->img_1.'" alt="'. $service->img_1.'" title="'. $service->img_1.'"></a> </div> <div class="card-body"> <h3 class="card-title">'. $service->headline.'</h3> <p class="card-text">'. $service->summary .'</p> <div class="card-action"> <a href="" title="'. $service->name .'" role="link" class="link">View service<span></span></a> </div> </div> </div> '; } } // Grey snippet text echo '</div> </div> </section> <div class="snip-2 light-grey"> <div class="container"> <div class="row text-center">'. $tag->get('grey') .'</div> </div> </div>'; } ?> I appreciate this is a long post but i'm trying to be clear as I appreciate everyone's time. Any insight into where I am going wrong is greatly appreciated. Liam
-
I want to add a few pages to an AsmSelect Page field inside a repeater using the following code: $trialsPage = wire("pages")->get(28422); // Get the page $trialsPage->of(false); $newTrial = $ordersPage->trial_repeater_orders->getNewItem(); // Add item to repeater foreach ($selectedProducts as $selectedProduct){ $productPage = $pages->get("template=product, reference=$selectedProduct"); $newTrial->trial_selected_products->add($productPage); } $newTrial->save(); $trialsPage->save(); However, when I check the page where the field is located it doesn't have the new values as expected. The selected pages exist, the field is in the right location, made sure that the output formatting is turned off: $page->of(false); But it still doesn't work with a variable. No matter what I try, it doesn't work. It only works when I replace $selectedProduct with a hardcoded string. Am I doing something wrong here?
- 10 replies
-
- inputfield
- asmselect
-
(and 2 more)
Tagged with:
-
So I have a form, once completed, will create new pages. All in all, this is eazy-peezy for me now. I guess I need a bit of guidance on how to actually structure the rest of my code. I thought I could just write a function (_func.php) and pass the fields to the function and let it do its' thing. However, I am kinda hitting a road block when I do it this way. I currently am passing first name, last name, city, state (options field), and making pages based on the first/last names. I guess where I run into some issues is I am trying to check to see if the "page" already exists, and if it does, throw out an error: In the home template: if(isset( $_POST['submit'])) { $firstName =Trim (stripslashes($_POST['firstname'])); $lastName = Trim(stripslashes($_POST['lastname'])); $fullName = $firstName . $lastName; $city = Trim(stripslashes($_POST['city'])); $state = Trim(stripslashes($_POST['state'])); $lowerCaseName = strtolower($fullName); $people = $pages->find("template=person"); foreach ($people as $person) { $checkFirstName = $person->first_name; $checkLastName = $person->last_name; $checkFullName = $checkFirstName . $checkLastName; if ($checkFullName === $lowerCaseName) { echo "<p>" . "This person has already created a page. Please choose a different name." . "</p>"; } else { echo "hey"; processNewPerson(need_to_pass_person_details_to_function); } } // end foreach In _func.php: function processNewPerson($list) { $u = new Page(); $u->template = "person"; $u->parent = wire('pages')->get("/people/"); $u->title = ; $u->first_name = ; $u->last_name = ; $u->state = ; $u->city = ; $u->save(); $u->setOutputFormatting(false); } I am a little unsure of how to actually pass all the information to the template, as well as if this is even the best approach to do this. Would it make more sense to do this in a class, or keep it the way it is?
-
Hey All. I need some help with a problem relating to users permissions to create pages and selectively remove a "new" button. I have a container page called "Sektionen" to keep Sektions of pages. These sections are created within different pages via a pagetable field. Now I want to change the way new sections can be created in a way that they can ONLY be created via the pagetable-field, not via the "new" button in the pages tree (see screenshot - this button should be removed). I think I can not change this in the templates settings and wanted to ask if anybody of you has an idea how to accomplish that? Thanks a lot!
- 20 replies
-
Hi Guys, Right now, I am using parents as breadcrumbs but I have pages under a parent page just to keep things organized. The pages are called in other areas of the site. I am trying to create user path history breadcrumbs. Meaning: If the user clicked a link to the page, it will show the path he took. Has anyone done this? Would love to see who has before I dive in. Thanks.
- 3 replies
-
- breadcrumbs
- path
-
(and 1 more)
Tagged with:
-
Hi, I'm creating a News/Updates section for a client and they would like the 3 most recent Updates previewed on the home screen. So this would be Title and Date Posted. These blog posts will be child pages of a News and Updates page, which is a child of the Home page. So it's like Home -> News -> Blog posts. I don't need this to be a nav menu, just something to show the newest updates. All help is appreciated ?
-
I have a script that is pulling in a json feed (will be attached to a cron job later) which looks like: $http = new WireHttp(); // Get the contents of a URL $response = $http->get("feed_url"); if($response !== false) { $decodedFeed = json_decode($response); } Everything there works well and I can pull the id, title, status (updated, new, sold) and other items from the decoded feed in a foreach loop. My whole goal is to create pages from the feed, but if the page has already been created, with all the same exact items from the json feed, I will need to "skip" over it. So far, I am running into a roadblock with my checks. I guess I need to compare the json to all my pages and their values and: 1. If an id already exists, check to see if a fields data has been updated and then update the page, 2. If an id exists and all fields are unchanged, skip adding that page $http = new WireHttp(); // Get the contents of a URL $response = $http->get("feed_url"); if($response !== false) { $decodedFeed = json_decode($response); foreach($decodedFeed as $feed) { $u = new Page(); $u->template = $templates->get("basic-page"); $u->parent = $pages->get("/development/"); $u->name = $feed->title = $feed->id; $u->title = $feed->title; $u->status = $feed->status $u->body = $feed->title; $u->save(); $u->setOutputFormatting(false); } } else { echo "HTTP request failed: " . $http->getError(); } I am really just hung up on how to do the current page checks and matching them with the json field data.
-
Hey there, is there really no way to turn the OR logic into an AND logic when selecting pages by (e.g.) tags? so instead of $pages->find("template=exhibitions, tags=foo|bar") something like $pages->find("template=exhibitions, tags=foo&&bar") so the pages needs to have all requested tags, not just any of them. Thanks, Stefan
-
I am using module "FormTemplateProcessor" to get data in a pages but they all are unpublished and when I am trying to display them with relevent pages it not working page1 p1 p2 p3 page2 (FormTemplateProcessor) up1 (unpublished page and have p1 id on field knows as "ID") up2 (unpublished page and have p3 id on field knows as "ID") up3 (unpublished page and have p2 id on field knows as "ID") now here up1, ip2, up3 can be created by p1, p2 or p3 and I am saving respectively I'm saving their id in field which is being used by up1,up2,up3, etc template. now I want to show the data from unpublished pages which belongs to p1, p2 and p3 respectively anyone has experienced this or knows something which can help me out ?
- 3 replies
-
- fields
- unpublished
-
(and 1 more)
Tagged with:
-
I am trying to filter my $pages with a find($selector method). $matches = $pages->find($selector); and this is an example of what my selector looks like $selector = "include=all, title|body~=$q, limit=50"; In this case, it only searches according to the matching exact words. For example:we search="art", the result="art times","these art",.... Is there any way to search based on the alphabet? For example: we search="ab", the result="absolutely correct","abstract art",....
-
Hello, How would I get the DB query that is used to gather the data for something like wire('pages')->find("template=log, id_gc={$serverId}, timestamp>={$dateStart}, timestamp<={$dateEnd}, sort=timestamp"); Tried using the Debug Mode Tools in the backend on a lister with similar selector. But I couldn't make out the right query in there. I'd like to use that query directly to dump data from the DB to a csv via SELECT INTO. Processing 10.000s of pages in chunks of 100 via the API into a csv. This is quite time consuming (several minutes for ~20.000 pages that result in a ~13MB csv file). Any help would be much appreciated.
-
Hey, I'm working around a module that adds pages in my ProcessWire installation. The pages are added based on a JSON array that will be imported through a page save. Everything works fine except for when the pages are added. I get the following error Integrity constraint violation: 1062 Duplicate entry '3e215ecd6774fd99c2b0eb5cadf36a07-1269' for key 'name_parent_id' I'm using the following code/loop to generate the pages. // Loop through the files foreach ($p->importFile as $file) { // Set the file location $name = $file->data["basename"]; $path = $p->importFile->path; $location = $path . $name; // Get the file $json = file_get_contents($location); $json = json_decode($json); // Loop through the rows of the import foreach ($json->ttEntityDelAddrLink as $client) { // Create new page $new = new Page(); // Create unique hash $unique = md5(date("Y-m-d H:i:s") . "-" . $client->CustomerCode); // Set some variables for the new page $new->setOutputFormatting(false); $new->template = "_client"; $new->parent = $p; // Create hash $new->title = $client->DelAddressName; $new->name = $unique; // Page specific fields $new->company = $client->DelAddressName; $new->companyId = $client->CustomerCode; $new->city = $client->DelAddressCity; $new->address = $client->DelAddressStreet; $new->postcode = $client->DelAddressZipCode; $new->country = $countries[$client->DelAddressCountryCode]; // Save the page $new->save(); } // Exit for debugging exit; } Does anybody know what's wrong?
-
Hi all, From my attempts it seems like this is not possible but thought I would raise it here before scrapping the idea and trying something else. I have an importer script reading a third party feed and creating some pages (page_type_A) based on that. It also creates some other pages (page_type_B) which are by default set to unpublished as the third party don't seem to have control over some of the data they send us, so we set them to unpublished so that someone on our end needs to approve them, so far so good. The issue I have encountered is that page_type_A at creation uses the API to set one of its fields to a particular page_type_B, the field is setup as PageSelector. When I look at the database this seems to work fine, but if you go into page_type_A the Page Selector list is always preset to blank? I updated the Page Selector and set the Selector String to use "include=all" which does populate the drop down with all the correct pages but since there all unpublished it never seems to be preselected to the one which is actually saved as in the DB. Hope that makes some sort of sense.
-
Alright. So I'm converting a site I already have to Processwire (really enjoying it so far!). I wanted to convert the previous tables that I had data in to Processwire pages. But I'm wondering what the optimal way to structure pages would be. So basically, I have three main tables. Users (and all accompanying information) Items (and all accompanying information) Aquariums (each user only has 1 aquarium. Currently, user_id is a FK) Fish (type of item. Aquariums may have multiple fish) Aqua_settings (Things like lightness, temperature, etc) So in my current setup, there are a lot of Foreign Keys. I could accomplish essentially the same thing by using the Page Reference field. Alternatively, I could make fish and aqua_settings both be children of Aquarium. I could differentiate by doing $aquarium->children('template=aqua_settings'); or something. So my question is...should I be using the Page Reference field or structuring the pages as children? (Or are both equally fine depending on how I want to go about doing things)
-
Hi all, Im looking for a selector that gets the pages added a specific time frame (eg. from yesterday 9:00pm to today 9:00pm). Is there a existing selector im missing or does someone now a good solution for this? Thanks in advance .
-
Hi All, I have a processwire setup for multi language which is english and arabic. I have a template called hotel which has title field act as hotel name for both EN & AR language. Since a week ago I was getting the error in Since we have key in pages table which states as below So the field name1056 should store the Arabic value of the title field. But its not storing the arabic value, since we have CHARACTER SET ascii for the field `name1056` as below Can anyone explain me * On what basis character set is defined? * Is there any specific reason for setting the ASCII character set? Thanks in advance for the help.
-
- name
- multi-language
-
(and 3 more)
Tagged with: