Jump to content

Pete Jones

Members
  • Posts

    88
  • Joined

  • Last visited

Everything posted by Pete Jones

  1. I was after a pure SQL solution rather than an API on but thanks for the pointer. I'll take a look.
  2. I have a PW install which takes a data feed (JSON). Currently I have a strange instance where certain images are being duplicated on import. I'd like to create a list of all the duplicated items including their 'name' (which is not the page name). I have the following query: SELECT C.`data`, COUNT(*) c FROM `field_h_media_url` AS C GROUP BY C.`data` HAVING c > 1; Which gives me all of the duplicates, but now I need to navigate my way through the PW data structure. I have the following structure: field_h_media (repeater) field_h_media_url (the external image URL) field_h_id (refers to the external ID of the horse) field_h_name (refers to the external NAME of the horse) I wish to show: Horse Name Image repeated Number of times repeated Thanks
  3. OK, so I've got the script to run but had 2 problems: 1) Dates - my dates are appearing as -0001-11-30 2) Titles - I probably need to concatenate 2 fields together for the titles - how can I do this? Thanks Pete!
  4. Hi Adrian, Do you just create a template file with this in it and run it?
  5. 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
  6. Neat. So for my page template I can put $config->ajax to check and render something else. The only problem is that I'm still returning the rest of my _main.php file. Can I prevent it loading for AJAX requests?
  7. Hi, I've got a long list of items to show. The list is a big table and when you click on a table row, additional information is shown (hidden table row). Part of this table row contains an image. Currently when I load the page, I'm loading all of the images too (not good), so I want to load the extra content onclick using AJAX. I'm using the delayed output model (_main.php/_init.php). How do I configure my templates so I can call a URL by AJAX and output the required content? Many thanks Pete
  8. I grabbed that one and it works perfectly for what I need. Thanks.
  9. I'd also be interested in a time only field.
  10. https://processwire.com/talk/topic/9400-how-to-get-all-unique-values-for-a-field/ Good discussion by LostKorakai.
  11. We have a members area (accessed via a login) which lists a load of horses. Much of the information here is members-only and has been stored as pages in the backend of the website (via a feed). We now wish to consume this information on the frontend (public) area of the site. In my template I can easily grab the horses and loop through them but on the frontend $horse->url returns the members area url so: members/horses/horsename Rather than /public/horses/horsename Is there a sensible way to solve this or am I going to have to resort to creating a custom URL format. grabbing a reference and passing it to the next page? Many thanks Pete
  12. Some interesting options here. Having looked at Twig, it feels like an added layer of complexity (and another syntax to learn). Macrura's wirerender pattern looks nice (https://medium.com/@clsource/the-wire-render-pattern-806bf6d6097a#.sy28dq9o1) as does Teppo's https://github.com/teppokoivula/pw-mvc Robin S approach seems simplest, does this have any drawbacks?
  13. I've been using the intermediate template structure (_init.php, _main.php and string concatenation to build output for my various template sections defined in _main.php This is a bit of a ball-ache as it renders my templates hard to use in editors (string concatenation doesn't work well with element matching/bracket matching. Is there a better way to put this together (not using includes)? e.g. _main.php <?php if($band1_content):?> <section class="w-section page-heading grey"> <div class="w-container inset-container"> <?php echo $band1_content;?> </div> </section> <?php endif; ?> band.php $band1_content = '<div class="w-container inset-container tabs filter-options"> <a class="w-inline-block pr-tabs" data-group=""><div class="pr-tabs-text">All</div></a> <a class="w-inline-block pr-tabs" data-group="'. $pages->get(1015)->name.'"><div class="pr-tabs-text blue">'. $pages->get(1015)->title.'</div></a> <a class="w-inline-block pr-tabs" data-group="'. $pages->get(1016)->name.'"><div class="pr-tabs-text green">'. $pages->get(1016)->title.'</div></a> <a class="w-inline-block pr-tabs" data-group="'. $pages->get(1017)->name.'"><div class="pr-tabs-text orange">'. $pages->get(1017)->title.'</div></a> </div>'; Pete
  14. Hi Kongondo, Thanks for that. Very useful. I did initially try just using it as suggested so perhaps got a field name wrong. I also take on board checking for variables before using them. Cheers Pete
  15. Slight newbie question that is giving me a strange result. I am using a FieldTypePage to include a reference to another page on the site (Case Study with a relevant member of Staff to contact). I have added the field type to my Case Study template and added content and linked it to the chosen member of staff. $contactId = $page->p_contact; echo $contactId; $contact = $pages->get($contactId); echo $contact->title; ContactId correctly returns 1023 but contact->title returns Home, not the title of the corresponding page. Is this an array of some sort starting with Home? How can I call fields in the corresponding page? Do I need to do something with permissions? Many thanks Pete
  16. I believe so. Can this be accessed in the frontend of the site?
  17. Hi, We're looking at creating a 3 level (guest, member, admin) user levels for accessing frontend content via a login. I have seen https://processwire.com/talk/topic/107-custom-login/page-1 which talks about creating the user login page. I have also seen http://modules.processwire.com/modules/frontend-user/ which is an older module which seemingly handles this but is still in alpha. We are creating a system where users need to login to see comments (members) but admin users are able to see additional information on some pages. What I'm looking for is something a little like: Can we hook into the User roles to do this? Thanks Pete
  18. Hi, We're looking for a PW freelancer (preferably based around Gloucestershire/South West - but will consider further afield) to build the front-end for a PW site we're currently building. The site has been designed (files available) and prototyped. Currently we are building the backend (members) area which pulls in a JSON feed and stores it in PW. This information is then shown to the Members. A restricted view of the data is shown to the public. Timescales for this project are to go live on W/C 18th April. Please post here with contact details and website URLs and I will contact you. Many thanks Pete Jones Head of Digital www.jfd.co.uk
  19. This is my first PW site so spotted the debug config element. Turned it on and realised my DB connection had a '-' not a '_' Problem solved. Thanks guys
  20. I have a local install setup with PHP 5.6. Does anything different happen at install if running under 5.6 compared to 5.4? Our development server (where I am migrating the install to) is running 5.4 and I'm seemingly getting 500 errors (possibly .htaccess) when migrating the site. Any ideas?
  21. Ahhh that's it. I was slightly confused by having a document_name as an additional field. Makes sense. Thanks BitPoet!
  22. I wish to show various bits of information on a File repeater (extension, filesize etc). The filename shows correctly, but the links to the files open the admin area, the file extension is empty and the filesize too. function renderDocumentLibrary($page) { $out = ""; if ($page->document_download->count()) { print_R($page); $out .= "<div class='row downloads'>"; foreach($page->document_download as $download) { $out .= "<div class='col-xs-12 col-sm-6'>"; $out .= "<div class='download clearfix'>"; $out .= "<a href='{$download->url}'><img src='{$download->ext}' alt='Download {$download->document_name}' class='download-icon' /></a>"; $out .= "<div class='download-content'>"; $out .= "<span class='download-date'>" . date('d.m.y', $download->modified) . "</span><br />"; $out .= "<h2 class='h4'>{$download->document_name}</h2>"; $out .= "<a href='{$download->url}' class='download-link'>Download {$download->ext} ({$download->filesizeStr})</a></div>"; $out .= "</div></div>"; } $out .= "</div>"; } return $out; } Can I access those attributes in this way?
  23. I have to agree. As first impressions go, this is excellent. Having spent years at the helm of Joomla sites and having just moved to an agency that has a WP back catalogue and have been dabbling in PW, it looks like they picked the right platform and more importantly community!
×
×
  • Create New...