-
Posts
812 -
Joined
-
Last visited
Everything posted by a-ok
-
Thanks for the replies. Unfortunately I tried this and it outputs the following (no need for ... "0" or "1" etc) {"0":{"type":"Feature","geometry":{"type":"Point","coordinates":{"0":"-1.466439","1":"53.376842"}},"properties":{"title":"Site Gallery","description":"Duis arcu tortor, suscipit eget, imperdiet nec, imperdiet iaculis, ipsum. Donec id justo. Aenean tellus metus, bibendum sed, posuere ac, mattis non, nunc. Suspendisse feugiat. Etiam rhoncus.","image":"\/Freelance\/art-sheffield-2016\/site\/assets\/files\/1032\/site_gallery.jpg","url":"\/Freelance\/art-sheffield-2016\/programme\/site-gallery\/","marker-symbol":"music"}},"1":{"type":"Feature","geometry":{"type":"Point","coordinates":{"0":"-1.477881","1":"53.374798"}},"properties":{"title":"Moore Street Substation","description":"","image":null,"url":"\/Freelance\/art-sheffield-2016\/programme\/moore-street-substation\/","marker-symbol":"music"}},"2":{"type":"Feature","geometry":{"type":"Point","coordinates":{"0":"-1.459620","1":"53.380562"}},"properties":{"title":"S1 Artspace","description":"","image":null,"url":"\/Freelance\/art-sheffield-2016\/programme\/s1-artspace\/","marker-symbol":"music"}}}
-
Hi folks, I want to pass some PHP arrays to JSON. I am managing to do this fine but the issue is that it wraps [] round the array, whereas I need it without [] to use it as geojson within Mapbox (https://www.mapbox.com/mapbox-gl-js/example/popup-on-click/). <?php $programme_array = array(); $programmes = $pages->find('parent=programme, sort=sort'); foreach ($programmes as $programme) { $title = $programme->title; $url = $programme->url; $summary = $programme->programme_summary; $image = $programme->programme_venue_image->url; $long = $programme->programme_location->lng; $lat = $programme->programme_location->lat; $programme_array[] = array( 'type' => 'Feature', 'geometry' => array( 'type' => 'Point', 'coordinates' => [$long,$lat] ), 'properties' => array( 'title' => $title, 'description' => $summary, 'image' => $image, 'url' => $url, "marker-symbol" => "music" ), ); } $programme_json = json_encode($programme_array, true); ?> [{"type":"Feature","geometry":{"type":"Point","coordinates":["-1.466439","53.376842"]},"properties":{"title":"Site Gallery","description":"Duis arcu tortor, suscipit eget, imperdiet nec, imperdiet iaculis, ipsum. Donec id justo. Aenean tellus metus, bibendum sed, posuere ac, mattis non, nunc. Suspendisse feugiat. Etiam rhoncus.","image":"\/Freelance\/art-sheffield-2016\/site\/assets\/files\/1032\/site_gallery.jpg","url":"\/Freelance\/art-sheffield-2016\/programme\/site-gallery\/","marker-symbol":"music"}},{"type":"Feature","geometry":{"type":"Point","coordinates":["-1.477881","53.374798"]},"properties":{"title":"Moore Street Substation","description":"","image":null,"url":"\/Freelance\/art-sheffield-2016\/programme\/moore-street-substation\/","marker-symbol":"music"}},{"type":"Feature","geometry":{"type":"Point","coordinates":["-1.459620","53.380562"]},"properties":{"title":"S1 Artspace","description":"","image":null,"url":"\/Freelance\/art-sheffield-2016\/programme\/s1-artspace\/","marker-symbol":"music"}}] Any thoughts? I know this is perhaps more PHP/JSON related question than a PW question but I just wanted to make sure I had this set up correctly.
-
Found it... $items = $pages->find("template=product, stock>0, (featured_from<=today, featured_to>=today), (highlighted=1)");
-
I need some confirming on how find selectors work... I have, for example, a page find selector setup as: parent=/portfolio/, sort=sort, project_location_london=camden, project_location_elsewhere=midlands What this would do is return any children of 'portfolio' that has project_location_london set as camden and project_location_elsewhere set as midlands. What I'm wondering is if it is possible to return any children of 'portfolio' that either have the project_location_london as camden or project_location_elsewhere as midlands, so it would retrieve both?
-
That totally worked. Can I confirm what the .sort does? Sort parent by the order set in the CMS?
-
Hi folks, I have a simple search setup, and I'm wanting the order of results to be sorted by parent then created date. I currently have this set up as: sort=-parent, sort=-created And here is a screenshot of my Tree structure from the CMS: However, when I get the search results; the result is putting Portfolio results before People results... any ideas where I am going wrong? I'm thinking it's to do with the fact that a 'person' has the parent 'People' but also 'People & Practice' but then couldn't work out why it was being returned in the order before 'Now'? EDIT: Thinking about it, it's because the ID of Portfolio is 1028 but the People ID is 1048; do I need to do it by sort first, then parent, then created? Thanks in advance, R
-
is it possible to set a default value of an integer input field type ?
a-ok replied to adrianmak's topic in Getting Started
This still doesn't work, by the way. I just need the default value to be 0. When I create a new page with that field, it's blank... not 0. -
Pagination issue with three different queries on one template
a-ok replied to a-ok's topic in General Support
I feel like what I almost need is for the page2 (or every page but the first) not to include the $first and $then queries. -
Pagination issue with three different queries on one template
a-ok replied to a-ok's topic in General Support
Thanks, adrian. If I put start=0, then when I go to page2 they all just start at 0... whereas it should only be showing me a continuation of the final query... not all three queries. For example, page2 looks exactly like page1... but it should just be showing the 'older' query. -
Pagination issue with three different queries on one template
a-ok replied to a-ok's topic in General Support
Thanks for the reply @Macrura. Really appreciated. I start my first query, to return the first post: <?php $first = $pages->find('parent=/now/, sort=-now_date_posted, limit=1'); ?> Then I do my second query, to return the next six posts: <?php $then = $pages->find('parent=/now/, sort=-now_date_posted, limit=6, id!=' . $first); ?> And finally the third query (the rest) <?php $older = $pages->find('parent=/now/, sort=-now_date_posted, limit=2, id!=' . $first . '|' . $then); ?> So you can see what it is doing; this is all part of the template that uses the pagination. The issues lies in when I go to page2, it goes through these stages again whereas it should just be using the $older query for everything onwards, which is why I used $older->renderPager(array()) for my pagination, which displays the right number of pages, but it is still using the same template. Can I limit the pagination return to only use the $older query? Please see attached how it currently looks so you can see the desired outcome... the smaller items at the bottom is the $older query. -
Pagination issue with three different queries on one template
a-ok posted a topic in General Support
Hi folks, I am using pagination on a news overview on my site. I have three queries set up on this page; a display first post, a display the next six (excluding the first) and then everything else (so excluding the first and the next six); so in theory the part I want to paginate starts at post 7 onwards. The only issue I have is when I click to the next page (page2) it shows the first post, the next six, then everything else, again. I understand why this is happening... it is using the same template for page2, page3 etc etc, which includes those queries. Below is my entire setup. Is there any way around this? I've tried using 'start' positions etc but doesn't seem to work properly. http://snippi.com/s/4ze4c4u (this is my entire setup for the news page) Any help or ideas? Many thanks. -
is it possible to set a default value of an integer input field type ?
a-ok replied to adrianmak's topic in Getting Started
So, in order to return 0, I would need to make blank and 0 different? -
is it possible to set a default value of an integer input field type ?
a-ok replied to adrianmak's topic in Getting Started
Hahaha updated all! -
is it possible to set a default value of an integer input field type ?
a-ok replied to adrianmak's topic in Getting Started
Can I bring this back up? The Integer field has an option (see attached) but it doesn't seem to do anything? -
Hi folks, Bit of an odd one... I'm adding some meta tags for Facebook and Twitter to the head.inc file and I'm trying to make the output per tag as global as possible. These are the tags I have so far: <meta property="og:title" content="<?php echo $page->title; ?>" /> <meta property="og:image" content="" /> <meta property="og:url" content="<?php echo $page->url; ?>" /> <meta property="og:description" content="" /> <meta name="twitter:url" content="<?php echo $page->url; ?>"> <meta name="twitter:title" content="<?php echo $page->title; ?>"> <meta name="twitter:description" content=""> <meta name="twitter:image" content=""> As you can see I have a few obvious ones set up, but I'm curious to know how you all might think about outputting the image and description meta information? I'm thinking finding the first image on the page and the first text output on the page but that's a little tricky, isn't it? Do you think these should be set up as separate fields for pages within the CMS for the client to fill out as they fill out the pages... as part of the process for SEO? And if there's any tips to why using these tags are bad please do say so. Many thanks, R
-
Hi folks, I am using the Select Options module to set up up options for content within a repeater (if the image you've added wants to be full, half or quarter width) and I have setup a few options: 1=Full 2=Half 3=Quarter This all works fine in the admin end; but on the front end I am trying to determine, for each in the loop, which options was selected. I have it set up like this: <div class="col-xs-12 <?php if ($image->issue_raw_image_width === 1) : ?>col-sm-offset-1 col-sm-10<?php elseif ($image->issue_raw_image_width === 2) : ?>col-sm-6<?php elseif ($image->issue_raw_image_width === 3) : ?>col-sm-3<?php else : ?>not-working<?php endif; ?>"> However, this isn't working at all; it just echos out my test 'not-working' class. If, for each, I ask it to echo out `$image->issue_raw_image_width` then it returns the correct value. Any thoughts?
-
Repeater field usability; reverse order/collapsed items
a-ok replied to a-ok's topic in General Support
@tpr and @LostKobrakai I guess the only problem would be that the 'Add row' button would be at the bottom, still? @Cerulean Thanks for this. This sounds good but I'm wondering whether you can change the order (new items added to top, not bottom) and whether you can set them to be collapsed by default? I couldn't find it in the documentation but maybe I just need to try it. -
Not a bad idea. I've done something similar with Forms before (storing as page etc.) but I'm intrigued with how you use Lister Pro for reports?
- 5 replies
-
- events
- management
-
(and 1 more)
Tagged with:
-
Repeater field usability; reverse order/collapsed items
a-ok replied to a-ok's topic in General Support
Thanks, adrian, for all your help. -
Repeater field usability; reverse order/collapsed items
a-ok replied to a-ok's topic in General Support
Do you know where I can see the dev list for PW? I know 2.7 just came out and wasn't on that so hoping for 3? -
Repeater field usability; reverse order/collapsed items
a-ok replied to a-ok's topic in General Support
Thanks for the reply, @BernhardB. PageTables sound like a good option but just seemed like a bit too much for what I wanted to do. @Can, yes so I could add a collapsed class to the rows already? That may work... just wasn't sure if there was an update to the Repeater module on the cards that would solve this. It would make a good upgrade, no? -
Hi folks, I have a repeater field set up and there's a few issues with the usability that I was curious to know if there were any options to improve this? Is it possible to make a repeater element add to the top, rather than the bottom? I know you can drag/drop but if it's a long repeater then it can get clumsy. If the possible isn't an option, is it possible to have the repeater rows collapsed by default? Any thoughts?
-
Ah right, I understand. I am using the ASMSelect for multiple pages. I thought, above all, if you have multiple pages you should at least be able to limit the amount you choose.
-
Hi folks, I'm scoping out a job and as part of the site they would like an 'Events' section. I have done quite a few of these which vary in complexities, but they are a client that has come from Wordpress and mentioned a 'Events Manager' plugin (http://wp-events-plugin.com/) which they used mainly for the following: Allow online booking Create reports about attendees Send group reminders/confirmation I'm wondering if there's anything that ProcessWire can do that is similar? I guess, per event, the user would select a number of tickets, include their name and perhaps some other information, then it would store this in the admin area somewhere – perhaps a form connected to a specific event? Then they could export this data to see everyone who is attending etc? Group reminders/confirmation I'm unsure about but any help with this would be appreciated. Thanks! R
- 5 replies
-
- events
- management
-
(and 1 more)
Tagged with:
-
I am using the Page field. So I'm guessing there's no option? Seems a little like an oversight, do you think (not to sound as mean as it looks!)?