-
Posts
4,043 -
Joined
-
Last visited
-
Days Won
67
Everything posted by Pete
-
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
-
Just a quick update - this is coming along nicely. What I'm just trying to add now is a nice select so we can select the sections who'se cihld pages should trigger a post to Twitter (otherwise they all do). If I can't figure it out with ASMSelect in the next 30 minutes then I'll just do it as a comma-separated list for now. Oh, and I included bit.ly to optionally shorten URLs as well.
-
Just finished some more stuff for the ProcessWire site which I'm about to send to ryan for his perusal before it gets uploaded, possibly early next week. Just a bit of forum/site integration that looks quite nice, but the code is a bit sloppy so I'll not upload it until it's been checked over I'll be working on the Twitter module again in about 20 minutes and hopefully it won't take me long to complete - maybe an hour or two. I should warn you that my self-imposed deadlines usually suck though, sorry
-
I know what you mean - many times I've looked for a complicated solution where a simpler one would do in ProcessWire.
-
Thanks ryan, I'll have a look at that when (if) I get some free time
-
Nice - I like these setups because it's obviously far less updating to deal with in terms of the core code, and they are indeed mostly on the same server in my case as well. Thanks guys
-
Hi Nico Sorry for the slight delay with this. I said a couple of hours, but it's now been several days (forum upgrade being my main distraction). If you can hold on a bit longer, I will be looking at this again on Saturday definitely, but this week is a bit hectic at work for me to looko into it sooner unfortunately.
-
I'm intrigued by this - can you go into more detail? It sounds great, but I can't quite visualise how it works from a domain name point of view or a technical point of view.
-
Ah, that'd be how I missed it - thanks
-
Sadly I've just done this and can't remember how to get it back again