-
Posts
4,043 -
Joined
-
Last visited
-
Days Won
67
Everything posted by Pete
-
Thanks for that ryan - I can see that I can access the array in a function from that - I added a hook that ran a function called 'test' just to drill down to the values: public function test(HookEvent $event) { echo "<pre>"; print_r($event->data['object']->attributes['value']); echo "</pre>"; } This works fine and I can see if a field has a default value, but unfortunately I don't seem to be able to add a value - could you point me in the right direction for that please? I'm not very good with OOPHP, so I tried the following to add page 1306 to the value array and it didn't work: array_push($event->data['object']->attributes['value'],1306); Aside from that I can easily see how to check the field name to make sure it's the one I want (useful as the template has 3 autocomplete fields ) so I'm halfway there. EDIT: Ah, hang on, I found setAttribute in the autocomplete module so I'm nearly there. Will post the whole thing up shortly
-
Nice module - and distributed under the WTFPL too
-
Hi ryan I've just come across a need for this in an autocomplete field. Would it be easy enough to do simply by checking for a field and overriding that module or is it a bit more involved than that? My thinking is to somehow override the current module, check for a specific field name and insert a default value if no values are stored for that field, but I'm not sure how possible that is. It's not a big issue, I just have a scenario whereby people will be posting news and it would be better to have a field that automatically stores their user ID as the author rather than making them select it themselves. The reason for the autocomplete is because there are already a large number of writers, plus just to make it even trickier more than one writer can be attributed to an article
-
Thinking about building an "easy" site profile
Pete replied to statestreet's topic in Themes and Profiles
Good work statestreet - that looks great! I think you're definitely right about the goals of such a profile - showing off enough to entice someone to learn more, wonder how it can be this easy, and actually be able to use it as their site (or rapid prototyping for a project or whatever they want ). -
Nice module Jim - this is very handy for one project I've got coming up as I can now integrate it with the company's domain to some degree and not have the hassle of people trying to change/remember their passwords in multiple places. It's also going to be a good starting point for another sooner project that was going to require me to code something very similar, so thanks as that will be coded in no time at all working from your module! I would have to change a forum setting and that would affect everyone's post, but it's possible to have everything appear right-to-left if you like
-
I think it's somewhere between the two to be honest. It can be simple (and deceptively so) but there are a lot of people who do get put off by code and just want to built a website, which is where site profiles will play a part later on It's a powerful tool for developers and design agencies, as well as being a great CMS for those willing to get their hands a little dirty (which I think includes anyone who's done much with the templates in Wordpress as well). I'm hoping that as the web seems to be evolving - to me at least - into more of a community where people want to get involved more that this will help ProcessWire to become even more successful. I certainly think the fact that pretty much everyone now knows someone who's had a go at building a website themselves, whereas you couldn't say the same thing just five or ten years ago, means that the time for people to get a bit more hands-on is arriving as people want more control over what they create. Or maybe I'm just daydreaming, but it's a nice dream
-
Hi Wes Welcome to ProcessWire Just a quick one - repeatable fields are currently being worked on and Ryan has released a video as well as hinting that they might be available this weekend. Can't link to the actual topic as I'm on my phone, but it should be easy to search for.
-
Thanks for this ryan - this one in particular makes sense in terms of the original post I think (assuming this is being called from the "Videos" page itself): $page->find("parent=$page->children");
-
I think you could just do this: $pages->find('color=');
-
Without actually testing this, I think you could just do the following to fetch those pages: $grandchildren = $page->children->children;
-
Thanks - that looks awesome! I'll have a play with it tomorrow at some point Like the sound of field-level access too - there's a lot of great stuff on the roadmap. Keep up the good word!
-
Is there a way to hide the publish button for a user? I've had a look around the forums and I can't see that this has come up before, but what I'd like to do is have it so that certain user groups can add pages, edit and save them but not publish them. The idea is that the new pages then have to be approved by someone with higher permissions before the page appears on the site. Linked into this, I'd also like the ability for the user not to be able to edit a page once it's published if that makes sense? So they can add a page (article in this case) tweak it and edit it, let someone with higher perms check over it and publish it, and then at that point the author wouldn't be able to edit the page. I feel like this should be reasonably easy to accomplish with a module but just need a friendly shove in the right direction Something completely different that crossed my mind but would be useful in my situation (and maybe others?) would be the ability to hide a field depending on the user group and set a default value instead. The scenario for this is articles again - I've been using an autocomplete field to tag authors to articles (very occasionally it will have multiple authors), but for users of a certain group I'd like this field to be hidden instead and default the value to their user ID - not sure if that's actually possible? It's not 100% necessary, but again if there's a way to do it with a module I'd happily give it a shot Just as an extra, yet not entirely relevant, piece of information, I was also considering adding a checkbox to the end of the Article temlpate so that the author could then tick the box to say it's ready for review by an editor, and then have a list of articles ready for review on the admin homepage. That might be of interest to someone else working on some sort of approval-based site section, so I'll happily share the code
-
memory requirements for module list page
Pete replied to Michael Martinov's topic in General Support
16 or even 30 is quite low for PHP. I don't think I've ever seen it set anything below 128mb personally, which is the default (see this page: http://www.php.net/manual/en/ini.core.php#ini.memory-limit ). The thing to remember is that it's not the memory required for the page contents, but rather running PHP and querying mySQL to process a given request - at least that's my understanding. -
I think it's possible that you may not have limited the image field to only have one entry (or it might apply wither way) but try: image_field->first()->url
-
I think that'd be the way to do it Ryan - it covers every website I've done so far as they all have admin thumbnails turned on. Obviously other people's scenarios will vary but that would cater for the majority I think.
-
Also worth noting that pagination won't display if the limit you set is greater than the number of articles you have. Sounds obvious but I confused myself tend other day first by not setting a limit and then by setting it too high
-
Here's another scenario that's slightly more suited to some sort of cache I think. All my articles have a publish_date field (datetime). On a sidebar, I'd like to list all the years for articles, and if I click on a year, list all the months that have articles for that year (it's basically an archive link list). This basically works fine as I've already built the code behind it, however I'm very conscious that to pull this together it has to iterate through EVERY article. Would the most sensible way to cache this be to use a module again, cache the result using MarkupCache and then perform a check for a new page being saved using the article template and rebuild the list? I'm thinking that to be flexible I'd probably just be safer caching a serialized array of all the relevant years and months. Also, since articles are becoming a bit sporadic on this site, how long can you actually cache something for using MarkupCache? Just wondering if that makes sense or if there's a better way - I'd rather not have to iterate through every article every time someone hits that section of the site I'm also finally going to play with pagination tonight. Should be fun!
-
Yup - you would create a template for team member and another for events and then create pages using those templates. What I would do is create a new template with nothing but a title field and call it "Team Members" and another the same called "Events" and set the page to be hidden in its settings (therefore it won't show in navigation and nor will its child pages - hidden pages are excluded by default). Then under that page, use the relevant templates and create your team members and events. It takes a while to wrap your head around the fact that pages aren't just pages, but once you get to grips with that the possibilities are limitless
-
I believe ther's a "remove formatting" button if you're talking about highlighting a piece of text that's styled and removing that style. The button name is removeformat and I don't think it requires a plugin. There's also a button to cleanup messy code (in case pasting something in creates a mess) but I think you may have already put a restriction on what gets pasted so this one might not be required. EDIT: Just tested it in MODx and I see what you mean about stacking up styles. The removeformat button nicely clears it though. I guess it's just a case of if you're using styles then tell your client to be careful and give them the removeformat button in case they do get into a pickle
-
It's possible that caching may not be needed, but I'm looking into it as it's a fairly well-visited site with a few hundred thousand page views a month (not massive, but not small either, so any increase in loading time is a bonus). The real reason I was looking into it is that by the time I'd finished my article template I'd called in various other bits and bobs (an example being Google's YouTube API for PHP to fetch and display a video - used the API as I needed to check if a video had a screenshot with it - most do, but you can't check without the API), plus there were a lot of blocks put together from content from other pages that, whilst the content won't change, was enough that it got me thinking about the overhead as one of the templates will be pulling in information from about 7 different pages so if I can cache that then that would be good. Thanks for the module - that looks to solve my problem completely since 95% of the content will never change, but those two bits will. I was also wondering if the way you and some of the others use templates could also achieve the same result? Not a problem if it doesn't, but I was just curious.
-
Hi chaps I've got a quick question about caching - I can't cache a whole template as I've got stuff in head.inc that needs to remain dynamic throughout the site. Is there some way to get around this? Also, if there is a way to achieve this, is there a way to make part of a template that's set to be cached non-cacheable? My example is that I have an article template that includes the head.inc and foot.inc files. There's a member bar in the head.inc that needs to remain un-cached (it can display alerts for new messages from my forums etc). Further down the article template is a section that spits out the latest comments on the article - again from my forums - and so that cannot be cached either. I realise I could use MarkupCache to cache certain bits of the page around the non-cache items and just append the page ID to the cache names, but that could result in many thousands of small cache files in one folder which isn't too tidy, plus I'd prefer to have the options that are available in the template cache (as in the knock-on effects on other pages in the site). Any suggestions are most welcome On another note, I have a suggestion to improve the cache feature: I have a field in my articles template called "game" (it's a gaming site, but it may as well be a blog or other article site). Each article is linked to one or more games using this field. Each game page never changes often, so can be cached indefinitely aside from one small block of code that fetches in a list of related artilcles. Currently in the cache options, we have the setting: "Clear cache for the saved page and other pages that I specify...". I think it would be great if there were a similar option where you could specify "Clear cache for the saved page and other pages in the following fields..." - then you could select fields linked to other pages that you know will have to have their cache emptied too. That way you can more specifically target which pages are cleared. My only problem there is that I would need to have that option in addition to "Clear cache for the saved page and parents (including homepage)" so I'm not sure how that could work on the current form - maybe just as a checkbox in addition to the radio buttons so they can be used in combination, which I imagine would then cover all scenarios.
-
Ah right, I was trying to preview a particularly lengthy article
-
Hi Nico I get the following error: Is it trying to pass the entire page body in a $_GET var? That's what it appears to be doing on my installation anyway
-
(sorry, checking the upload limits slipped my mind - glad you found it Ryan!)