-
Posts
4,054 -
Joined
-
Last visited
-
Days Won
67
Everything posted by Pete
-
I've got a situation where I've got a "request a callback" type form on every page, and a normal contact form on the contact page for a website. I noticed that if you re-use fields and don't fill the name out on the Contact form, it displays the errors on BOTH forms. I then changed the fields so they each had their own fields, and then when you submit an empty contact form it correctly displays the errors for the contact form, but the other form is replaced by the "Thanks you, your submission has been sent" message. So... there are some issues with multiple forms on the same page Is there any easy way to tweak the code so that it handles multiple forms correctly? I was thinking the easiest might be to pass the template name as a hidden field and also use it as the ID for the form - that way some checking could be made which then correctly processes only the one form (I'm assuming it processing any forms it finds at present?).
-
(Got sidetracked porting 3 sites to PW, but they're all nearly done now so I'm hoping to find time to look at this again this week).
-
PHPMyAdmin would be my preferred choice. Unless you have literally hundreds of thousands of pages, the single-file dump that it creates is fine, and you can also specify that it be zipped prior to download. On a slightly related note (that doesn't help you unfortunately ) I have some excellent backup scripts that run via cron jobs that back up site and database information that I'll have to post here at some point. They use system commands that I imagine you wouldn't be able to run on your hosting, but might be useful for others.
-
On IIS7 you don't even need ISAPI URL Rewriter from what I remember when tinkering with our server at work - if you go to Microsoft and download the IIS version of PHP from there there's a tool that actually converts the htaccess directives to something native that IIS can use. They're actually getting better at native support of PHP. Not that that helps if you're not using IIS7 or don't have control over the server, which I imagine maybe you wouldn't on shared Windows hosting
-
Looks like a pirate's cutlass to me. Either way he's a special little lion who's had his front paw replaced with a human arm and stabbed himself accidentally through the head so we'll let him off
-
I only just realised he has a human hand too Forwarded this to one of my friends who's from Sweden and he found it very amusing
-
I'd go for ryan's suggestion still. It's really not a lot of work. Unless you mean that the second set of identical links will always be identical? In which case why not just add an if statement in your function to check if you're currently outputting the "Some Other Page" menu item and then simply get the Holiday subpages with: $pages->get('/holiday/')->children; and then just loop through them as part of that if statement? If it's just this one place and the submenu is always going to be identical with links back to the holiday sub-pages then that would be the way I'd think about doing it.
-
Oh yeah, much better solution ryan - I keep forgetting how flexible fields and templates are
-
Change this bit to do the following: foreach($c->children as $subpage) { if ($subpage->name == 'history-of-rock') { echo "<li><a href='{$c->url}#rockmusic'>{$subpage->title}</a> "; } else { echo "<li><a href='{$subpage->url}'>{$subpage->title}</a> "; } } I think that will do it. Not sure if the dashes are required when checking for history-of-rock - think I'm right as the name is the SEO-friendly title of the page.
-
VERY nice work. My only criticism would be that when you load a new section the images load after the animation - would be good to pre-load the images if you can so they're already loaded when they slide into view.
-
I was having a look through them last month in relation to updating them - whilst I didn't get very far on the docs ryan, these still looked pretty relevant with maybe just some minor tweaking required. I've actually got some time tomorrow evening to look at this if you don't get time before then
-
Very good point
-
In which case you could set up your categories as pages under a categories page - these would then return any entries in that category. This would be set up in the way I first mentioned so in your article template you create a field with type "Pages" and you can link an article to multiple categories. Then you can grab all articles from that category reasonably easily to display on the category page (we'll get back to the automatically related articles in a bit) using something like this where $page->name is the category page you're viewing: $articles = $pages->find("category=$page->name, limit=50"); where 50 is the limit for the number of articles to return. In terms of tagging, you simply get all tags for the current page (we're assuming "tags" is a text field with just comma-separated tag names) and use similar code to the above to return all articles with the same tags: $related_articles = array(); $tags = explode(',', $page->tags); foreach ($tags as $tag) { $tag = trim($tag); $articles = $pages->find("tags*=$tag"); foreach ($articles as $article) { if (!isset($related_articles[$article->id])) { $related_articles[$article->id] = $article; // Not sure if this saves any overhead - just makes sure we're not overwriting duplicate array entries if 2 articles have the same tags } } } Then you can iterate through your $related_articles and print the list. I'm not sure if the search is case-sensitive, but I would suggest inputting all your tags in lowercase just to be on the safe side. Another interesting thing you can do is count the number of times a tag appears and create a tag cloud for all your articles (this would require getting all tags for all articles, but it's just a variation on the above).
-
Well I guess the question here is what determines how they are related? Similar words in the title such as "apple"? It might be better to go with a "tags" field for that approach (basically a text field with comma separated values and just do searches on the tags field for other articles containing the same tags. If you could give us a better idea of how you would see it being automated ie. what the module is looking for in order to determine how a page is related, then I'm sure we can come up with other suggestions.
-
If you wanted to code something yourself and work with a good class to achieve this (in Twitter anyway) then Tijs Verkoyen's Twitter class is absolutely excellent and he also has a bunch of other handy classes: http://classes.verkoyen.eu/ - just make sure you use the Oauth version of the class. Granted I've only used it to display tweets from Twitter and not publish anything to Twitter, but I'm sure that side of things works well too.
-
This can already be done easily with a field. Simply create a new field with type "Page". Under the Details tab make sure "Multiple Pages" is selected.Under the Input tab, change "Parent of selectable page(s)" to be your parent blog page (ie. the page that all your articles come under). Finally, change "Input field type" to be asmSelect to allow you to mre easily select multiple blog entries. That's the hard part done. Then in a template you can iterate through that field and display links to related pages EDIT: I guess that technically you would want the link to work both ways though so it you link one page to another then if you're viewing the other page it would link back, but it wouldn't be too hard to do - simply do an additional search on all pages with the "relatedpages" field and return results with a link to the current blog entry - that way you don't have to worry about adding links between multiple pages.
-
A different way of using templates / delegate approach
Pete replied to Soma's topic in API & Templates
This is actually pretty similar to what I do with a system I use as well though I'd not thought of it for PW - thanks for sharing -
Nice additions - would you mind sharing the code?
-
It comes with cPanel/WHM and has the best support team I've ever seen. Certainly the only host I've used that proactively monitors servers so if anything goes wrong it's automatically rebooted and you get an email about it - very handy for when you're asleep and something goes wrong so you don't wake up to a headache Speeds seem the best of any US host I've used as well. I'll dig put my server specs and let you know what I'm on.
-
They're in the readme file here: https://github.com/ryancramerdesign/FormTemplateProcessor Not saying this will help, but it might.
-
Ah, another one I encountered a while back - do you have the relevant styles in your stylesheet for the error messages? I'm not 100% sure you would see them clearly or at all without the CSS.
-
I had something similar a while back - are you sure the fields you've set as required are actually spelled right in both the formbuilder code and the HTML code? If they don't match then they won't get checked - that was my issue anyway.
-
She could have a degree in law. You never know The SEO comment was from a couple of years ago so it might well be fixed by now. I think part of it at the time was that it was a slow system (at least back then) and you defintely get penalised for slow loading pages as well as poorly optimised ones. So don't take my word for it - they've released several large updates since then and it might all be fixed
-
Looks to me like everything iss done through Git. They seem to purely host applications that they've tested so you can be sure the config is right, and you do cahnges on your PC and push them to the server through Git. No FTP or things like that, just a quicker workflow (potentially). The BIG issue I have with it is the bandwidth. 100GB a month isn't all that much nowadays (one of my sites uses more than half that each month) but I suppose you would only be hitting it if you were hosting lots of videos or files for download on your own space, which I guess in the case of PW you wouldn't. Still very expensive though! I use Storm on Demand from Liquidweb which scales based on usage. Obviously you'd have to set some upper limits otherwise a day's extremely high traffic could cost you an arm and a leg (unless you were prepared to take the hit to keep the content being served). It's cloud-based and I've been with them long enough to know it should scale well.
-
I was thinking the same thing only yesterday I don't think you actually have to do much other than create some XML files from what I was briefly reading through, which doesn't sound too painful - depends what the contents have to be I guess.