-
Posts
10,902 -
Joined
-
Last visited
-
Days Won
349
Everything posted by adrian
-
Gotta love bitbucket and SourceTree
-
Just thought you guys might like to know that the priority setting just got another user Needed to solve the conflict between RedirectIds and 404Search modules. Thanks again Ryan for thinking of everything!
-
Store and output visited pages with $session or $_SESSION
adrian replied to nfil's topic in General Support
Actually I don't think that makes any difference in this hypothetical case. The $p->template check doesn't look to see if the template file exists, just the name of the template assigned to the page. So assume it hits a page with that template - it will then move to the "viewable" check. Assuming there is no template file, this will force the "continue". So this means that you still can't check just the assigned template and page status (not hidden or unpublished). I think that makes sense. But, yes, now we are really getting silly - sorry for starting it -
Store and output visited pages with $session or $_SESSION
adrian replied to nfil's topic in General Support
Since we're in a clarifying mood , the catch with $p->viewable is that there must be a template php file for the page, so this isn't a complete fix for using ->get and making sure it is not hidden/unpublished. Maybe this instead of viewable? !$p->status>=1024 I know it won't matter for this script because we are looping through pages that were at some point viewable (even if the status was changed in the meantime), so they must have had a template file at some point and likely still do. Sorry, I know I am getting too pedantic and off-topic now - time to sleep -
Thanks for the report - I was developing it on 5.5 and have now tested on 5.3, so hopefully we are covered now It makes sense that your include file was not added to the zip. Hopefully you noticed the message after the import to that effect - it mentions that you need to copy any .inc and other supporting files yourself. At the moment the migrator will only add template php files to the zip that are tied to the templates used in the pages that are exported. I have actually contemplated scanning through the template files looking for include, include_once, require, require_once and grabbing those files as well. I'll have a think about it and see if I think it makes sense to do that. The blog profile zip I attached a few posts back was manually modified to contain all the associated inc, js, and css files, but everything else was direct from the automatic export process.
-
Thanks Marty - glad to hear it is working for someone other than me - I was beginning to wonder Also, I just set up php 5.3 testing environment and everything seems to be working there now too, so hopefully I won't be wasting Pete and Antti's time when they try again! But please keep the bug reports and feature suggestions coming!
-
Oops - sorry about that Antti, and for the delayed response - was out enjoying some unseasonable sunshine! I just pushed a quick fix that should work for older versions of php. I need to set up a 5.3 testing environment. EDIT: Pete - the export process should now also provide friendly errors if a required option is not selected.
-
Hey Pete - sorry about that. Sounds like you are exporting. The issue is that you haven't selected anything in the "Parent Page" or "Components to Export" option. My bad for forgetting to provide a friendly error instead of failing, but if you choose something in that step, you should be fine! I'll fix it in the next version. Let me know how you go
-
I tend to agree with horst on this, but it can make life a lot easier if you learn some basic implementations of ternary operators, depending on how you want to structure your html and php. This can be easier: echo $page->Departure_AUI ? "<div>Aui: {$page->Departure_AUI}</div>" : ""; In my mind it really comes down to whether that div can be left empty, or if it must not be echo'd at all, which depends on your layout. It can also be easier sometimes to build up sections of content in a variable first. $out = ''; $out .= $page->Departure_AUI ? "<div>Aui:{$page->Departure_AUI}</div>" : ""; $out .= $page->Departure_MAG ? "<div>Mag: {$page->Departure_MAG}</div>" : ""; echo "<div id="block-parent">$out</div>";
-
Soma's right you guys, you just need to use json_decode to get it into an array. From there you can foreach through the array and do whatever you want with it. You could even extract the content to add to PW pages for storage if you want. Given kimonolabs limits on the free option, that might be a decent idea. Cache the results in PW. They have a limit of 100 per hour, so even once a minute would be ok.
-
Of course you could even add back in the user you want first: $users->add("name") And then add the role to that new user! PS some of these options only show in the cheatsheet if you click the "advanced" button.
-
$user = $users->get("test"); $user->addRole("superuser"); $user->of(false); $user->save(); Or if you want to actually do it through the database, you can go into PHPMyAdmin and find the page ID for the user you want to change (from the pages table) and then go to the field_roles table and change the "data" value for that pages_id to 38
-
kixe, Thanks for sharing those - I'll add them to the module, but I do have a question about the ITU E.123 format. It seems strange to me to have the extension appended directly to the number like that. I don't honestly know that much about phone number formats, but I took a quick read of this document: http://www.itu.int/rec/T-REC-E.123-200102-I/en and the key thing I got from it regarding extensions was: To show an extension number of a PABX without direct in-dialling, the nationally used word or abbreviation for "extension" should be written immediately after the telephone numbers and on the same line as the word "telephone", followed by the extension number itself. Example 2: Telephone international +22 607 123 4567 ext. 876 Any chance you could explain to me the difference between this and the format you have composed, which would output: +22 607 1234567876 Thanks
-
Store and output visited pages with $session or $_SESSION
adrian replied to nfil's topic in General Support
Hey teppo, Possibly I am missing something so wanted to clarify with you: I often chain get and find for finding all the children/grandchildren of a particular single parent. Compare this to "->get->children(selector)" which of course only returns first level children. I know that it doesn't work for what @nfil is after, but wanted to clarify how they can actually work together for those that are new to PW. Also, curious what you think of: $p = $pages->get($page_id); if ($p->template != "basic-page") continue; echo .... vs $ps = $pages->find("id=$page_id, template=basic-page"); foreach($ps as $p){ echo ......; } The first option (your suggestion) is likely more efficient, but just wanted to point out the second option to others and make the note that, in this case, you need a find rather than a get, because with a get, the id= selector overrides anything else after it. -
Hi again everyone - I have spent quite a lot of time on this the last few days and it is now much more robust and feature rich. In an effort to encourage some testing from you guys, I have attached an export of Ryan's blog profile that you can install into an existing PW site. Download the attached zip file Grab the latest version of Page Tree Migrator from Github (https://github.com/adrianbj/ProcessPageTreeMigrator) and install. Make sure your templates directory is writable by the server Run the module from the your Setup menu Choose "Import" and continue to Step 2 Choose the Parent Page - choose "Home" which will install the blog as a first level child of your homepage. Make sure "Everything, including all data pages" is selected for Components to Import. From Data Source, choose "Zip File Upload", browse to the blog.zip file. Click "Upload and Create Content" and wait a few seconds. That's it - you should have a fully functioning blog set up at: Home > Blog It comes complete with the same test entries, images, gallery, tags, categories etc that Ryan's original one does, although I did add in one extra photo, embedded into an RTE and resized - the photo comes from Joss' Foundation 5 profile. The one thing you'll notice is that the embedded Youtube link doesn't work, because the Video embedder module isn't installed. Page Tree Migrator will install core modules as needed, but obviously can't install other ones - yet You'll notice that the blog is installed with its CSS and script files in a subdirectory of the templates folder to avoid an overwriting of existing files. Please test and let me know what you think - Thanks! blog.zip
-
True, true - I use that sometimes too when dealing with small json snippets, but head to one of those others when things get larger. Lots of options I guess - in general it blows me away all of the cool dev tools we have available now - almost too many - could spend all your days investigating new things and not getting anything done
-
Hey teppo - the key thing for me is the ability to quickly collapse objects and arrays to make it easier to see what's what and avoid endless scrolling.
-
Hi Ralf, If I understand correctly, it should be a simple matter of: if($page->Departure_AUI){ echo "<div>Aui: {$page->Departure_AUI}</div>"; } There are shorter/cleaner ways of doing this, but I think this is the most understandable for someone new to php. Hope that helps!
-
Wow - you've outdone me with the visualization dendogram from jsonmate Check out the skyscrapers demo:
-
drag and drop fields in a template does nothing?
adrian replied to gyaani's topic in Getting Started
Hi gyanni and welcome to PW! You can echo out any field that is available in the template that is assigned to the page you are viewing, just like in your example. Drag and drop sorting of the fields in the template changes the order that the fields will appear in when editing any pages that have that template assigned to them. Does that make sense? -
Module: Video embed for YouTube/Vimeo (TextformatterVideoEmbed)
adrian replied to ryan's topic in Modules/Plugins
Hey Pierre-Luc, There is actually a note about https on github: https://github.com/ryancramerdesign/TextformatterVideoEmbed/pull/3 Perhaps you should add to that issue, or start a new one. That will be the easiest way for Ryan to track the problem. -
Glad you got it all working as you wanted. Remember we are all learning everyday, whether it is something new in PW or learning something else in another code language that I haven't needed to do before. It's part of the fun and the frustration
-
I don't think I completely follow - if you are on a page with a single blog post, then $page should refer to that one post. I am not sure why you are selecting the children of the page. However, if you are on a parent blog page showing more than one post, then you'd need to limit your selector to each specific post. If neither of those make sense for what you're trying to do, you could get really ugly and populate an array inside your foreach and only echo the author if it is not already in the array: $authors = array(); foreach ($page->children->find('author!=""') as $child) { if(!in_array($child->author->title, $authors)){ echo $child->author->title; } $authors[] = $child->author->title; } But you really shouldn't have to do that - I think you just need to get your selector specific to your post.
-
Are you talking about articles that are rendering at the moment you want to query this, or just all the articles that have the currently viewed video selected in the video page field on the article's page? I am still not convinced I know what you want - sorry, but if the latter, then something like this would do it: foreach($pages->get("template=articles,video=$video_id") as $article){ echo "<li>{$article->title}</li>"; }
-
If I am understanding you correctly (which I am not sure I am), then I don't think pageStack is going to help you here. From your video page you need to do a search through the page field that is in your articles template and look references to the video that is currently being displayed. Does that sound right?