-
Posts
4,056 -
Joined
-
Last visited
-
Days Won
67
Everything posted by Pete
-
Just going back to the option of storing it outside of the web root, it doesn't look like it would be too hard to create a new fieldtype based on the InputfieldFile.module Obviously this doesn't help you in your current situation, but I'm thinking out loud so ryan could possibly comment on this ryan - it seems that there is a $this->destinationPath variable. Whilst you can't link directly to a document outside the document root, is it technically possible to extend the module and have it create a folder outside the root, then set this variable to point to it (and on a page-by-page basis have it create a subfolder with the document ID as the subfolder name?). If so, then with a little work it wouldn't be too hard to have the path configurable (I think). Since you can't automatically serve a file that's above the document root directly, there would need to be a function in the module that deals with this as well, but I think that if this sounds do-able to ryan then I might take a stab at it at some point in the future (next few weeks are pretty busy, but after that then maybe ).
- 27 replies
-
- 1
-
-
- private
- protected files
-
(and 1 more)
Tagged with:
-
Videos inside processwire: How to embed videos inside processwire?
Pete replied to jester.vergara's topic in FAQs
Well I think it would be a good module - I don't think that if you were putting multiple videos on one site that the dimensions would be different for each vid, so globally setting it would be fine. The only other thing I can think of is specifying either different dimensions for different templates or for different fields. Something like the config options in Antti's thumbnail module is what I'm thinking for that. -
There's a very good and elegant example in the default head.inc file that does exactly what you're after - well worth a look
-
Just updated this to version 1.1.0 as it now supports the ability to upload an image with a post There's now an additional field called allowedPagePhotoParents that lets you pick page parents that you want to have the child pages upload an image along with a tweet. The original allowedPageParents field is still there, so you can specify sections where a new page will only create a text tweet, and if you select the same page in both lists, the photo field will take priority and it will try and upload a photo (seemed the easiest way to get around two conflicting values in the lists). If the page you save is in a section that is in the allowedPagePhotoParents list, it will check for an images field on that page and, if it finds the field and there is at least one image in it, it takes the first image and passes it along to Twitter along with the link to the page as well as your optional configurable tweetText prefix text. EDIT: Only slight thing is that this class comes with some sort of certificate file (part of advanced authentication I think) so the module package is a lot bigger. It shouldn't be a problem though as the module will only be run when a page is saved, and that certainly doesn't happen every second.
-
Videos inside processwire: How to embed videos inside processwire?
Pete replied to jester.vergara's topic in FAQs
I like that idea ryan, so basically any YouTube URL you type into the editor gets converted when the page is rendered -
Updated the module to fix some errors with variables. It would have worked fine before, but there was an unneccessary line as well as an unnamed variable.
-
Of course I just realised you may already know that and the date/time field should probably know that too is probably what you mean
-
The date you're experiencing is when unix time is counted from (you'd have to google it to find out why - I can't remember) so a value of zero means zero seconds since that date. Strange but true.
-
With regards to this module, I'm looking to expand the included Twitter class to support sending photos as well (seems logical since Twitter now natively supports photos so they display inline in feeds). It's needed for a website I'm building so it makes sense. My only worry about that idea is that at present you can select multiple parent pages whose child content will be auto-tweeted. How could I go about optionally selecting which categories would send a photo to Twitter? The most likely option is that I'll have a config option to turn photo uploads on/off and have it just be a global setting, so if there's an images field in the template, it just takes the first picture and uploads it. I suppose another option would be to have two more config fields - one for "sections whose children upload the first image from the images field" and "sections whose children upload ALL images from the images field" and have them as ASMSelects based off the first ASMSelect (if that's possible). Or just a comma-separated list. The latter option of uploading all images would be good for news sections for any type of site, but in my mind I've got a gaming site with 3 exclusive photos accompanying a new article for example. That assumes Twitter will allow multiple images per tweet and what the limits are.
-
Sorry, I think it's Markup Cache module and not Fieldtype - I forgot to specify which one (the Fieldtype cache module is on by default whereas ModuleCache isn't).
-
Thanks ryan - you're right, I didn't have debug mode on whilst I was coding it so that's one to remember in future and I'll take a look at those variables at some point this week. As for the code, it was made reasonably easy with Tijs' classes, and I'll admit I know very little about "try catch" (I think those blocks of code were adapted from one of his examples) but I did have fun implementing that ASMSelect in the config (I was surprised how simple it was in the end actually once I worked it out). I'm actually getting pretty into the idea of turning third party classes into installable, configurable modules. I've got a few fun ideas I'd like to try out at some point involving automated weekly emails using something like PHPMailer or perhaps MailChimp - with good enough classes and good enough reasons to turn them into modules the options are pretty limitless, though obviously licensing issues come into play in some cases.
-
Thanks, I'll bear that in mind. It was to do with the IPB Forum module I sent over to you so I found a good enough solution in the end by adding it to the $page object
-
Could you try uninstalling both modules and then reinstalling the cache one first and see if that helps please?
-
I worked it out - you have to install the Cache module as well, which is present in the default PW installation, just not installed by default (I already ahd it switched on on my test account!). That will make it work, but I do need to put some sort of check into my module to make it a bit easier (need to read the posts around here on module dependencies).
-
Hmm... that's odd, I'll take a look at the module. Cheers for checking that though.
-
Assigning pages to a Subnavigation, featuring those pages on homepage
Pete replied to Alex's topic in Getting Started
What you've done is grabbed the pages into an array called $items, so $page isn't relevant further down (easy mistake to make). Try changing this: $image = $page->images->first(); to this: $image = $item->images->first(); -
It sounds like your site/assets/cache directory might not be writeable (it needs to be in order to be able to cache the sitemap). Hopefully making that writeable (CHMOD 644 probably) will fix that. The cache folder itself isn't solely related to this module, so I'm sure you would have come across that message sooner or later. Hope that fixes it for you
-
I'm being an idiot. Fetching the module as per the code example above is the way to go. Not sure why I had a sudden allergic reaction to having to have one line in the template, wereas I would have to have lines of code elsewhere in the template to output the results of the functions anyway. I'm not even sure there is a better way to include an external class and access its functions than this, especially since I want to create some custom functions that aren't available as part of the class itself.
-
Hi Nico Do you have a more detailed description or a code example of what you're trying to do? Specifically which function you're trying to stop?
-
I need to make an external class available to all templates. It's configurable, and rather than have to edit the config file I'd rather make it available by using a configurable module. I know I can bake objects and variables available for us in templates simply by using $page->somename = $object_or_variable by hooking it in befor page render, however I'd like to create several functions in the module that are then available on every template on the site. I've been looking at the FormTemplateProcessor module for inspiration, as this seems to do pretty much what I'm after, but I'd like to have it automatically available rather than having to fetch it at the top of the header template like this: $form = $modules->get('FormTemplateProcessor'); I know it's only one line of code, but since I would like the functions to be available site-wide (front-end and admin), I'd prefer a way of making it available automatically. Any suggestions? Rather than me posting examples (because I don't have any yet) let's just pretend I want to automatically load the FormTemplateProcessor module and have its functions available
-
Welcome to ProcessWire I'll start off by saying that my only role here is administrating the forums, so I don't speak in an official ProcessWire capacity. With that bit out of the way, I can't say I agree with everything in the article those comments are attached to as they're mostly the result of trying to bend a blogging system to do something that it's not designed for, but I did move a website to ProcessWire a few weeks back because of the regular admin changes and what I personally see as inflexibility in the templates. I think my problem was that each time I checked out Wordpress (probably 6-9 months unless I was applying an update to that particular site) there seemed to be just enough changes to confuse me (esasily confused). If I was using it day in and day out it probably wouldn't have been a problem if I'm totally honest with myself. I know part of runing a website for a client is keeping on top of updates, but I wanted a system that was simple to patch (in the case of ProcessWire I've recently learned that you can run multiple sites from the same core files, so there would only be one /site directory to update for all sites - something that I find quite exciting ). I came to PW from a MODx perspective, and much as I loved MODx and the way it tried to keep things tidy with the use of snippets and chunks as well as prevent PHP in templates with it's tagging system, I was converted primarily by the jQuery-inspired API and also when I read Ryan's article on syntax and finally wrapped my head around the idea that a Page in ProcessWire is whatever you want it to be. Following on from that last statement, one of my plans for this year is to build a fairly complex file download repository in PW. I looked at all manner of scripts for that task last year, and when I'd been using ProcessWire for a month or two this year I thought to myself "how hard would it be to build such a system in PW?". The more I thought about it, the more things clicked into place in my head and now, rather than trying to make two separate programs work together - and the invevitable issues with any third-party file download script not having all the fields I might want - I can do it all in one system and what's more I'm pretty sure I could build it over the course of a few weekends. The thing that I quickly learned is that the majority of what I want to do can be done in ProcessWire. The majority of the functionality I requested early on, Ryan had actually already built and it was just a case of knowing the API functions (Soma's PW cheatsheet is invaluable once you've learned the basics), and there are exciting things on the roadmap such as multi-content fields and a page workflow are on the roadmap. I think the biggest thing that keeps me coming back here though is that every suggestion you make is considered and everyone is friendly as well. It's not something I've encountered much before, and in some cases (not going to name the software) when I've constructively suggested things on other CMS forums I've actually felt likve I've been jumped on and told to contribute if I want a feature. Not everyone is a good programmer, but I think everyone can have good ideas and certainly provide valuable suggestions and feedback, often leading to Ryan putting a feature on teh roadmap or in the case of really good ideas implementing the code into the latest build seemingly overnight, and I think that sort of relationship is what makes this community really work. Have fun with ProcessWire - I know I do Oh, and there's no such thing as a dumb question - every CMS has a learning curve.
-
Just in case you didn't spot it Nico, I released this yesterday here: Any chance I can take a look at your Facebook code?
-
Hehe, it's only because I tend to have more time to look at it on the weekend, although I must admit I thought this would take longer and contain less features than it ended up having.
-
Just an additional few thoughts: It would be nice to upload photos to Twitter so this could be used with galleries, but this class doesn't have that functionality, nor amI entirely sure the Twitter API allows you to do it through the API. It doesn't include any check for length before trying to post the tweet. I'm pretty certain however that a tweet that is too long will still throw an exception so you should still see an error message Carrying on from number 2, it would be nice to have a character counter next to the Tweet Text field so you know how many characters you're using Carriny on from 3, it would also be nice if there was some indicator when editing the page to give you an idea of how the tweet would look as well as how many characters, so you could override the default Tweet Text value if the whole thing with the page URL makes it too long All of these are just random thoughts - if someone wants to implement any of them then please feel free, however I've gone as far as I can and as far as I need to with this version so I don't plan on doing much more to it except any bug fixes
-
As per this thread, I've been working on a module this afternoon which automatically posts a tweet on Twitter when a page is saved. Important Settings You must have a Twitter account You need to sign up for a dev account, as you will need a consumer key, consumer secret, oAuth Token and oAuthTokenSecret from Twitter When creating your "application" on Twitter, please ensure you set it to read/write and not just read, else it won't be able to post! You can enter a prefix for your url, such as "Check out our latest blog post:" You will need to select "categories" whose children this module will apply to. Eg. if you have two root pages called News and Gallery and you want to post a tweet about any new pages created directly under those sections, then select them from the Allowed Parent Pages dropdown (if nothing is selected in this field, the module simply doesn't do anything ). There ar two Allowed Parent Pages lists as of v1.1.0 - the second one is for tweets with a photo upload to Twitter and will attempt to upload the first image from the "images" field for the current page (if the field exists and there is at least one image uploaded). Optional I thought that whilst I was at it I might as well add bit.ly support, so you will need your bit.ly username and a bit.ly API key to have your URLs automatically shortened, else it will post normal URLs in your tweet I've also put a decent amount of error checking in there so it should warn you if there's anything missing. You don't have to worry about double-tweets. The class I used to connect to Twitter will prevent this, although when you save the page it will still tell you that your tweet was posted successfully. To delete any tweets you've created whilst testing, or tweets you don't want for whatever reason, log in to Twitter to delete them. Credits As from 1.1.0, the class used is from Matt Harris who is on the Twitter dev team (@themattharris) - his full library is on GitHub and contains a lot of good examples for interacting with Twitter in other ways. I switched modules as Matt's class allows for the picture upload functionality. I'm leaving in the bit below about Tijs' class as he has a lot of other good classes and without his Twitter class I wouldn't have actually been able to start work on this modue at all. Aside from the usual thanks to those module authors whose code I've inspected to build this (mostly ryan I think this time - I worked out the ASMSelect from the InputfieldPage module), none of this would be possible at all without Tijs Verkoyen's Twitter and bit.ly classes which are bundled with this module. Check out all of his awesome classes here: http://classes.verkoyen.eu/ EDIT: I've attached the modile as a zip file to this post since Github is being a git and won't let me push my commit for some reason. SocialTwitterUpdate.zip