Jump to content

a-ok

Members
  • Posts

    812
  • Joined

  • Last visited

Everything posted by a-ok

  1. This works a treat, Robin. Thanks for the help. Let's hope it gets pushed to master soon.
  2. I'm using the Map Marker (Google Maps) module with PW 3.0.61 within a Repeater field which is inside a Repeater Matrix field (I know I know!) but I open to add the data to the field it's just showing a blank map. Inspecting the DOM all the HTML is there and the Google Maps API JS link is included in the source (with the API key) so I'm a bit at a loss. Any other way I can check what's going wrong?
  3. Hi folks, I'm running PW 3.042 on one of my sites and all was working well but I've received a weird bug/issue from a client. I have a page which has a repeater with two fields (image field and an options field) and they've managed to add 32 rows, no problem, but now when you upload an image... it shows that it's uploaded but when I click 'Save' it seems to clear out the image? I checked the logs... no errors and then checked the assets folder to that repeater row and the image is in there! Weird! If I try to add the image again... does same thing again. However, if I go to Admin > Repeaters and find the page that is related to the row and if I add the image in there it works no problem! I am at a loss... any ideas? I followed Ryan's idea here to checking the AJAX response... And there is no error (this is what I get) [{"error":false,"message":"Added file: marika_hackman_w3.jpg","file":"\/site\/assets\/files\/1192\/marika_hackman_w3.jpg","size":570776,"markup":"<li id='file_f35023be4d35b02a8417fe344d56c6b1' class='ImageOuter gridImage ui-widget'><div class='gridImage__tooltip'><table><tr><th>Dimensions<\/th><td>1129x1500<\/td><\/tr><tr><th>Filesize<\/th><td>557&nbsp;kB<\/td><\/tr><tr><th>Variations<\/th><td>0<\/td><\/tr><\/table><\/div>\n\t\t\t<div class='gridImage__overflow'>\n\t\t\t\t<img src=\"\/site\/assets\/files\/1192\/marika_hackman_w3.260x0.jpg?nc=1496787004\" alt=\"\" data-original=\"\/site\/assets\/files\/1192\/marika_hackman_w3.jpg?nc=10\" \/>\n\t\t\t<\/div>\n\t\t\t\n\t\t\t\t<div class='gridImage__hover'>\n\t\t\t\t\t<div class='gridImage__inner'>\n\t\t\t\t\t\t<label for='' class='gridImage__trash'>\n\t\t\t\t\t\t\t<input class='gridImage__deletebox' type='checkbox' name='delete_journal_image_repeater1192_f35023be4d35b02a8417fe344d56c6b1' value='1' title='Delete' \/>\n\t\t\t\t\t\t\t<span class='fa fa-trash-o'><\/span>\n\t\t\t\t\t\t<\/label>\n\t\t\t\t\t\t<a class='gridImage__edit'>\n\t\t\t\t\t\t\t<span>Edit<\/span>\n\t\t\t\t\t\t<\/a>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\n\t\t\t\t<div class='ImageData'>\n\t\t\t\t\t<h2 class='InputfieldImageEdit__name'><span contenteditable='true'>marika_hackman_w3<\/span>.jpg<\/h2>\n\t\t\t\t\t<span class='InputfieldImageEdit__info'>557&nbsp;kB, 1129&times;1500 <\/span>\n\t\t\t\t\t<div class='InputfieldImageEdit__errors'><\/div>\n\t\t\t\t\t<div class='InputfieldImageEdit__buttons'><small>\n\t\t\t<button type='button' data-href='\/login\/page\/image\/edit\/?id=1192&file=1192,marika_hackman_w3.jpg&rte=0&field=journal_image' class='InputfieldImageButtonCrop ui-button ui-corner-all ui-state-default pw-modal-large pw-modal' data-buttons='#non_rte_dialog_buttons button' data-autoclose='1' data-close='#non_rte_cancel'>\n\t\t\t\t<span class='ui-button-text'>\n\t\t\t\t\t<span class='fa fa-crop'><\/span> Crop\n\t\t\t\t<\/span>\n\t\t\t<\/button>\n\t\t\t<button type='button' data-href='\/login\/page\/image\/variations\/?id=1192&file=marika_hackman_w3.jpg&modal=1&varcnt=varcnt_journal_image_repeater1192_f35023be4d35b02a8417fe344d56c6b1' class='ui-button ui-corner-all ui-state-default pw-modal-large pw-modal' data-buttons='button'>\n\t\t\t\t<span class='ui-button-text'>\n\t\t\t\t\t<span class='fa fa-files-o'><\/span> \n\t\t\t\t\tVariations\n\t\t\t\t\t<span class='ui-priority-secondary'>(0)<\/span>\n\t\t\t\t<\/span>\n\t\t\t<\/button>\n\t\t\t<\/small><\/div>\n\t\t\t\t\t<div class='InputfieldImageEdit__core'><div class='InputfieldFileDescription'><label for='description_journal_image_repeater1192_f35023be4d35b02a8417fe344d56c6b1' class='detail'>Description<\/label><input type='text' name='description_journal_image_repeater1192_f35023be4d35b02a8417fe344d56c6b1' id='description_journal_image_repeater1192_f35023be4d35b02a8417fe344d56c6b1' value='' \/><\/div><\/div>\n\t\t\t\t\t<div class='InputfieldImageEdit__additional'><div class='InputfieldImageEdit__additional--keywords'><label for='keywords_journal_image_repeater1192_f35023be4d35b02a8417fe344d56c6b1' class='detail'>Keywords<\/label><input id=\"keywords_journal_image_repeater1192_f35023be4d35b02a8417fe344d56c6b1\" class=\"InputfieldMaxWidth\" name=\"keywords_journal_image_repeater1192_f35023be4d35b02a8417fe344d56c6b1\" type=\"text\" maxlength=\"2048\" \/><\/div><\/div>\n\t\t\t\t\t<input class='InputfieldFileSort' type='text' name='sort_journal_image_repeater1192_f35023be4d35b02a8417fe344d56c6b1' value='0' \/>\n\t\t\t\t\t<input class='InputfieldFileReplace' type='hidden' name='replace_journal_image_repeater1192_f35023be4d35b02a8417fe344d56c6b1' \/>\n\t\t\t\t\t<input class='InputfieldFileRename' type='hidden' name='rename_journal_image_repeater1192_f35023be4d35b02a8417fe344d56c6b1' \/>\n\t\t\t\t<\/div>\n\t\t\t<\/li>","replace":false,"overwrite":0}] I'm at a loss what to do... any thoughts?
  4. Hi folks, Thanks for the replies and apologies for not getting back sooner. I meant exactly as bernhard described... looping over the FIELD in a $pages->find selector. Not to worry... thought it was a long shot! Thanks for all the help.
  5. Is there a way to do this as one selector? The below obviously doesn't work but wondered if something similar is possible? $archives = $pages->find("template=ab-archive-detail"); foreach ($archives->ab_archive_archives as $archive) : I'm trying to loop through the image field ab_archive_archives on each of the pages with the template ab-archive-detail as one selector... Thanks!
  6. Ah it's because the URL in the JS was search to url: rootURL + 'search/', (rootURL being declared as var rootURL = config.urls.root;) but I have multi languages set up on the site so the URL was wrong.
  7. Sorry to bring this post back up but I'm having a slight issue implementing this. I have something almost identical to @Jan Romero and in the console I can see the specific term being returned as I type (see screenshot) BUT the variable, in this example $s = $input->get->text('q'); isn't being returned so all the results are just searching an empty string. <form id="projects__search" method="get"> <input type="text" name="q" placeholder="Search" /> </form> Any thoughts?
  8. This is special. Thanks, Robin. I had no idea this was the best approach and makes a lot of sense (categories still exist in their own page tree outside news but can exist within via the URL). Thanks to everyone else for chiming in too!
  9. Thanks all. Super appreciated. I have added 'category' as a URL segment (see attached) so in theory anything /news/category/ should work now. However, I'm guessing I still need to include a rewrite on the category template? I had a look at the other forum posts from ryan and noticed this... if ($input->urlSegment1 == 'contact') { // render the /about/contact/ page echo $pages->get('/about/contact/')->render(); return; } else if($input->urlSegment1) { // throw a 404 throw new Wire404Exception(); } But I am unsure how I can harness this?
  10. I've been creating categories and tags via Pages and PageFields for a while now but the thing that has always bugged me is, if for example I have a section 'News' (/news/) and a page parent/child for news items 'News (categories)' (/news-categories/) then if you filter by a category then the URL slug is /news-categories/architecture/, for example... whereas it would be nice if the URL slug was /news/categories/architecture or similar. I know this creates a few anomalies because the categories aren't actually a child page of /news/ but I think it's a lot cleaner and makes more sense visually. I've been trying to think of the best way to achieve this. I could do a rewrite... or I could place the hidden page for categories within /news/ and work from there? I just wasn't sure if there was a solution or best practice that anyone on here has used before? I tend to have a few different category pages for different sections (News, Projects etc). Thanks guys! What I currently do: News ---Article 1 ---Article 2 News (categories) HIDDEN ---Category 1 ---Category 2 Would this work? News ---Article 1 ---Article 2 ---Category HIDDEN ------Category 1 ------Category 2
  11. I think this still gives me the same problem... I'd still need to build the data as JSON before passing it into fractal.
  12. I realise this may be a generic JSON/PHP question but I want to make sure I'm harnessing the API correctly from the beginning. I want to create a JSON data output of pages of my site, as well as individual pages, but I'm unsure how to do this as one whole output. I know and can output, for example, projects within a project, but how do I also output the homepage content, and other page content, at the same time? The JSON output would include things like 'home' and 'project' arrays but would be blank if you aren't viewing the homepage and or project page... if that makes sense. $projects_array = array( 'projects' => array() ); $projects = $pages->find('template=projects-detail, sort=sort'); foreach ($projects as $project) { $project_content = array( 'id' => $project->id, 'title' => $project->title, 'name' => $project->name, 'size' => $project->projects_categories_projects_size, 'img' => array( 'featured' => $project->projects_detail_featured_image->url ) ); array_push($projects_array['projects'], $project_content); } $projects_json = json_encode($projects_array, true);
  13. What do you think @POWERFULHORSE?
  14. Ah yes okay! Thanks for the help! I wonder what would happen if there are no $curated articles... I guess it wouldn't show anything (whereas it should return the latest 4). I could do the following... if (count($page->global_inspiration_related)) { $curated = $page->global_inspiration_related; $nr_of_inspirations = 4 - count($curated); $inspirations = $pages->find("parent=/inspiration/, id!={$page}|{$curated}, sort=-global_published_date, limit={$nr_of_inspirations}"); $all = $curated->import($inspirations); } else { $all = $pages->find("parent=/inspiration/, id!={$page}, sort=-global_published_date, limit=4"); }
  15. Hi folks, I have a simple news > article setup on a site I am building and at the bottom of the page I am outputting the latest 4 new articles... fairly simple. I will also add in so it doesn't include the current article you are viewing but ignore that for now. Also for each article, in the CMS, the client can choose if there is a related article they'd like to include (instead of the latest 4) up to a maximum of 4. So if they choose one related article it would include that, first, then continue with the latest 3. If they choose 2 related articles then it would show those two first then continue with the latest 2 and so on. I pretty much have the setup for this... see my code below... but I just wondered if this is the best way to do it? I have to output my HTML twice (one for the related articles and one for the latest) which is fine but I guess I'm wondering if there's a way where I don't have to (reducing extra effort by the server). Let me know what you think... I thought I'd post this in case it helps anyone else in the future although I realise the question is fairly bespoke. I'll also need to do a check that the selected related article isn't part of the 'latest posts' either! I'm also wondering if you can slice from the end (rather than from the start). Thanks! <?php $inspirations = $pages->find("parent=/inspiration/, sort=-global_published_date, limit=4"); ?> <?php if (count($page->global_inspiration_related)) : ?> <?php $curated_count = count($page->global_inspiration_related); $inspirations = $pages->find("parent=/inspiration/, sort=-global_published_date, limit=4")->slice($curated_count); ?> <?php foreach ($page->global_inspiration_related as $child) : ?> <!-- do something --> <?php endforeach; ?> <?php endif; ?> <?php foreach ($inspirations as $child) : ?> <!-- do something (same code as above thus outputting the HTML twice) --> <?php endforeach; ?>
  16. I found this too but I don't want 'Add page' etc etc. I just want the pages from Home that I have added (including children).
  17. Apologies if this has been asked before but I cannot find an answer. I'm using the PageField and want the returned pages to be all the pages under Home (including any children) but ignoring any hidden/admin pages etc. Any thoughts?
  18. Haha! No I don't believe so? If the page isn't 1037 or 1038 then do this...?
  19. Is there any reason why this wouldn't work? <?php if ($page->id !== 1037 || $page->id !== 1038) : ?> I have no problem using if the page id equals the current page but not if not.
  20. Hi all. I'm using a simple parent/children page setup to act like categories (Categories > category 1, category 2, category 3 etc). When adding a new page, using the PageField, the user can multi-select which 'categories' this page relates to. Simple. On the front end I am looping through the categories: <?php $categories = $pages->find('parent=/categories/, sort=name'); ?> <?php foreach ($categories as $category) : ?> <li><a href="#" data-name="<?php echo $category->name; ?>"><?php echo $category->title; ?></a></li> <?php endforeach; ?> This is then going to act as a filter... however... I'm wondering if it's possible to only show the categories that are currently in use... rather than showing them all? What do you think?
  21. I guess rel links should always be allowed...
  22. Thanks. I'm unsure where I am going wrong then... <?php if (!$config->ajax) $session->set('count', 0); ?> <?php foreach ($news as $article) : ?> <?php include('./inc/news-item.inc'); ?> <?php endforeach; ?> In news-item.inc I have $session->count + 1;
×
×
  • Create New...