![](http://processwire-forums.s3.us-west-2.amazonaws.com/set_resources_6/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
encho
Members-
Posts
81 -
Joined
-
Last visited
-
Days Won
1
Everything posted by encho
-
I can't believe I'm the first one to ask Is there a place I can post a feature request?
-
I have been looking for this, but to no avail: is there a setting to adjust password length/complexity/other requirements? Thanks.
-
I have been using it for more than a month on one of my websites, and I am really pleased with it. Good work!
-
Just to hijack this topic, I am trying to integrate Piwik API, and here is what I have found till now. <?php $token_auth = 'xxx'; $url = "http://stats.site.com/"; $url .= "?module=API&method=Actions.getPageUrls"; $url .= "&idSite=3&period=day&date=today"; $url .= "&format=PHP&filter_limit=5"; $url .= "&token_auth=$token_auth&segment=pageUrl=@articles&flat=1"; $fetched = file_get_contents($url); $contentp = unserialize($fetched); // case error if(!$contentp) { print("Error, content fetched = ".$fetched); } echo "<ul>"; foreach($contentp as $row) { $keyword = htmlspecialchars(html_entity_decode(urldecode($row['label']), ENT_QUOTES), ENT_QUOTES); $hits = $row['nb_visits']; $keywordfull = rtrim($keyword,"/index"); $ptitle = $pages->get("path=$keywordfull"); echo "<li>"; echo "<a href='/".$keywordfull."'>".$ptitle->title."</a>"; echo " (".$hits.")"; echo "</li>"; } echo "</ul>"; ?> This is based on Piwik's own example, with few 'gotchas'. First, &segment=pageUrl=@articles is used to filter results to include only articles/*. Second, &flat=1 will include full list of urls. Third $content clashes with my template so I have used $contentp. But I am obviously doing something wrong, as site is reduced to crawl occassionaly, since I have implemented the idea. Maybe $pages->get is not efficient way to do it?
-
Thanks again. The reason behind this is not to track the posts (I use Piwik for that), but to have convenient "Most read article" or "Popular today" section/block.
-
What about ProCache? Would that impact the results?
-
It seems more complicated than I thought it would be (thanks to my beginner level in php). The following code seems to be working, but not sure about few things (and whether it will work tomorrow): <?php $page->of(false); if (!$user->isSuperuser()) { $datetoday = date('Ymd'); if(!isset($page->dateref)) { $dateref=$datetoday; } else $dateref = $page->dateref; if( $dateref != $datetoday ) { $page->counter = 1; $page->dateref = date('Ymd'); } else { $page->counter += 1; } } $page->save('counter'); $page->save('dateref'); $page->of(true); echo $page->counter; ?> (used 'dateref' field instead of 'date', as that one is already in use) 1. I had to setup the dateref field's output as Ymd in field settings, strtotime doesn't work for me. 2. If I don't put $page->of(false); before the code, it will produce an error "Call $page->setOutputFormatting(false) before getting/setting values that will be modified and saved." Any implications to place it in the beginning? 3. If dateref field is not set, the output will default to 1970... so I had to set that to date('Ymd') in case value does not exist. 4. $page->counter = 1: if set to 0, it won't register first visit. It is working as it is, but not sure how safe/proper the code is. Any insight appreciated.
-
Thanks, very useful post as always will try that. I agree, but unless you have an idea how to do this, this is good enough for me.
-
This is great, I will use it for 'Most popular articles' in my sidebar. Another idea: how to take this even further and count today's views only? So we can have something like 'Most popular today'.
-
That clears it. Went for 'dev' option, planning mass-converting my existing sites to PW
-
Quick pre-sale question I am planning on using the form builder on 2 or 3 websites that I'm developing. Question is: if I upgrade them down the line to 2.3, would the module still work? Or I'm better off buying 'dev' version which will give me updates for a year?
-
Can you let me know how that works for you. I have few websites I'm working on and don't want to use the old base if the new one is just around the corner
-
Integrating a member / visitor login form
encho replied to thetuningspoon's topic in General Support
Thanks, that explains a lot. Just perfect for my needs. Checked my log and found out that my error is actually coming from not being able to create user template.(?) EDIT: the actual error is "TemplateFile : Duplicate entry 'user' for key 'name' INSERT INTO `fieldgroups` SET `name`='user'" When you say: add it to the 'user' template, is 'user' built-in template or something else? -
Integrating a member / visitor login form
encho replied to thetuningspoon's topic in General Support
<?php if sense_of_humor ?> Wow, and we have to do everything ourselves? <?php endif ?> Great topic, really learned a lot. EDIT: Everything working except that part where reset email was sent, password did not reset at all. Would be also nice to have another page which really resets the password, ie email will include link to that page. That way, if user ignores the email, no real changes would be made. -
I definitely prefer friendlier shorter urls, so I will go with your second option, I think that is exactly what I need. I prefer to keep things simple, so when editor hits 'new post' he will choose (apart from title/body part) category name, author, and issue no. I was contemplating for a long time should my posts go under category, author or issue, which one is more important. So decided just to go under 'posts' instead, keeping it more real and not having to choose between the three. Thanks to ProcessWire and its great community support, I am free to choose other approach down the line if I have to. Only one more tip: as I am using blog template as a starting point which already uses the segments for the rss feeds, I am not sure how to incorporate the code above (second one, 404 avoiding) to the existing one, keeping rss as well: include_once("./blog.inc"); if($input->urlSegment1) { // check for rss feed if($input->urlSegment1 != 'rss') throw new Wire404Exception(); $homepage = $pages->get('/'); renderRSS($page->children("limit=10"), $homepage->get('headline|title'), $homepage->get('summary|meta_description')); } else { // display paginated blog list $headline = $page->get('headline|title'); $content = renderPosts("limit=10", true); include("./main.inc"); } Help very appreciated.
-
Sorry to hijack this topic, but how would one do it other way around? I have page 'posts' and all articles are in there. But I want my url to be /posts/category/article/ instead of just /posts/article/. 'Category' is Page reference field. I am happy as it is, but my old site which I am converting from (made in Drupal) had it that way, so to avoid 404 errors, would like to know this. Thanks.
-
Amazing, that does it, with minor adjustment (template=post). Many, many thanks. Now sky is the limit
-
Not my day I guess. @diogo your second code is still reporting unexpected T_DOUBLE_ARROW edit: first code works perfectly fine, I can display all the authors with number of posts, thanks. Now just to sort them by post number. @soma what is this posts.count part? It is reporting "Field does not exist: posts.count", should there be field name or?
-
Thanks for your try, first part of code does not produce valid results because field 'author' is page reference, so it actually produces an ID. Second code is giving me 'Parse Error syntax error, unexpected T_DOUBLE_ARROW' and there is a bracket ')' missing. But you're right this seems complicated, although you seem to be on a right track.
-
I am really puzzled how to do this: I have posts template with custom field called 'author', which is basically 'page field' referring to other page in the site where I keep list of the text authors. In a nutshel I want to display list of 5 authors with most texts associated with them. If authors had subpages containing the text of the said author, this would not be an issue, but pages are actually elsewhere (primary sorting is by other criteria, categories). So first part of the problem is how to get pages, which should be like this: $authors = $pages->find("template=author, sort=count, limit=5"); So obvious problem is this 'count' part where it should calculate posts that have field 'author' used the most. Second problem is how to display the number of posts every author has. I will need to rethink the whole scenario if this would not be possible (but considering it is ProcessWire we are talkin about, it shouldn't be an issue ). Thanks.
-
Thank you for this module, very useful. I have imported comments from my old website to pw (through MySQL script into field_comments table) and for some reason I can not approve/delete any of the new ones I post, the 'save' doesn't do anything. But this module sorts the things out, well done.
-
Thanks! That worked. I was not aware of the debugging option, really useful. Using diferrent cms' over the years I have neglected the php/sql, and instead I have learned different cms-specific tags and scripts. This is great opportunity to renew my skills.
-
Tried the code above and I get generic error 'Unable to complete this request due to an error. Error has been logged.' This is my code from standalone file, just replaced query part (btw I am not MySQL expert, just borrowed the code): $day = date('d'); $month = date('m'); $table = "timetable"; $rows= array(); $results= $db->query("SELECT event,time,location FROM $table WHERE day = '$day' AND month = '$month' ORDER BY month ASC"); if ($results) { // loop through the result set and inspect one row at a time while ($row = $results->fetch(PDO_FETCH_ASSOC)) { array_push($rows, $row); } } $event = $rows[0][event]; ... What am I doing wrong?
-
Thanks, will try this code. And as for your suggestion for the repeater, I am still in process of learning. I need quick solution now and later I will spend more time investigating it. In mean time if someone has done something similar, please feel free to post it here
-
As mentioned in the title, I have table in my database (same as PW) with 366 rows and want to display the fields on my site. I hate starting from scratch otherwise I would use repeater field to make it lot easier, but still struggling with basic concepts, so with more time I will eventually import csv into repeater fields through the api. Table has columns: month, day, event, time, location. I have the php script working independently, using separate file for credentials to do mysql query, but I would like to use PWs already established connection to query my database. I have searched but found nothing on the topic. Please advise.