-
Posts
17,307 -
Joined
-
Days Won
1,725
Everything posted by ryan
-
When you get a chance, and when you feel its ready, it'd be great to get it posted in the modules directory too: http://modules.processwire.com/add/
-
How much SEO value to photos have anyway? I would think the SEO value would come from the descriptions of those photos, not the photos themselves. So by alternate links and/or sitemap, I was thinking something like this: <li><a href='/path/to/photo.jpg'>Description of photo</a></li> or <li><a href='/path/to/page/photo-jpg'>Description of photo</a></li> In the second example, 'photo-jpg' would be a URL segment and it would instruct the page's template to just display the 1 photo having that name, and with description (in alt tag and/or in the content area).
-
Reading and displaying data from a custom table
ryan replied to einsteinsboi's topic in General Support
This sounds like a fun project! Does the data need to stay in this external table, or can it live in ProcessWire instead? If the data can live in ProcessWire, your cron job could very easily update the data by just bootstrapping ProcessWire. Bootstrapping is as simple as: include("/path/to/pw/index.php"); One-time importing data from an external source is also very easy to do via the API. So if you can do it, I would just let the data live in ProcessWire instead of an external database, and it'll make the whole job a piece of cake. But if that data needs to stay external, then Sinnut's solution is a good way to go. You would use the DB's primary key (or some other unique column) to serve as the urlSegment that loads the page. You'd setup one page/template to handle all that data, and it would find it like this: $key = (int) $input->urlSegment1; if(!$key) throw new Wire404Exception(); $result = $yourDB->query("SELECT make, model, year FROM your_table WHERE id=$key"); if(!$item->num_rows) throw new Wire404Exception(); list($make, $model, $year) = $result->fetch_row(); echo "<ul>"; echo "<li>Make: $make</li>"; echo "<li>Model: $model</li>"; echo "<li>Year: $year</li>"; echo "</ul>"; Note: enable URL segments on the template where this code is (on the URLs tab), as URL segments are not enabled by default. This is another reason why it may make a lot of sense to keep all the data in ProcessWire. But if you can't do that, it won't be a problem: all you need is for your pages to contain a reference to the primary key of row they map to in your external table. I would suggest using the built-in "name" field for those pages to map to the primary key in your external table, because you know it'll be unique and relevant. But you could always create a separate integer or text field in ProcessWire do handle it too. But lets say you use 'name', then your page templates could load the data like this: $result = $yourDB->query("SELECT make, model,year FROM your_table WHERE id='{$page->name}'"); -
That's correct, if you want to find pages by a field called cats, then you'd use "cats=" instead of "id=". To find pages matching all the categories, specify multiple "cats=" statements (rather than 1 split by "|" OR bars). So the code example you posted is correct.
-
Nested repeaters may be technically possible, but the potential overhead would be huge and it seems like all sorts of possible complications could arise. So definitely not recommended. You are right that I should remove the capability to do it--I've just made this change and will be committed shortly.
-
You might want to look at using a repeater for this, as it would enable you to do this pretty easily. Though cloning and modifying the existing images fieldtype would enable you to do all this too (with a little more work).
-
Thanks Geniestreiche! Nice site you've put together there. Thanks for posting and welcome to the forums!
-
Thanks Biotech, I have fixed this now and it's in the current source. Turns out it only does that in Firefox, but the fix was easy (CSS: clear: both;)
-
Good find, I have updated it to be 7 characters. (we didn't use to have a character limit when this was originally written)
-
Are you talking about copying/cloning an entire page? If so, install the ProcessPageClone module, which is included with the core (just click install from the Modules screen. But if you are talking about cutting/copying a block of text and putting it somewhere else, then of course nothing can beat your browser's built-in copy/paste.
-
There are so many great ways to present photos that it'd be hard to narrow it down. Soma linked to a really cool one recently, but now I can't seem to find that link. Most of these solutions use jQuery/Javascript to take a semantic (SEO friendly) list of images and convert them to some kind of interesting presentation. Given that your client doesn't like thumbnails, I'm thinking you are probably looking at some sort of image slider. There are lots of these out there, but this one (Zurb Orbit) is the one I've already got open so figured I'd link it. You (or your selected gallery script) will probably want to use javascript to assist in the loading of images, so that you need not load them all in the initial request. This is where you start running into search engines not being able to see them. But so long as you are providing an alternate path by linking to them or linking to page(s) containing them, that's what you need. If necessary, you can use your JS initialization to hide those links once your JS takes over responsibility of presentation for them. But disable JS in your browser to test your alternate paths and make sure you can still get to all the images one way or another. It also doesn't hurt to get a site map in the mix.
-
The other good thing about MailChimp is that they are very pro-PHP and they use it for everything.
-
What are the settings on that page reference field? Usually when you've got a timeout, there is some circular reference. For example, a repeater referencing a category page that in turn somehow references back to the original page. Or a page reference in a repeater that references back to the parent page or repeater items. ProcessWire detects and prevents most of this, but the question becomes more complex when a repeater is involved. What were the last edits you made before the timeout started occurring? I don't think it's an issue of quantity, I really think there must be some kind of circular reference in there, especially given that a Page reference in the repeater. You may be able to track it down by editing the repeater pages directly: Page List > Admin > Repeaters > drill down to it from there.
-
Looking good Arjen! I've not used MailChimp so can't get too deep into it since I don't have the platform to run it, but a quick look at the code and it seems like you are on the right path. Actually I probably should use Mailchimp since they are just a few miles from my house, and they gave me a nice t-shirt. Having some nice PW integration makes it very enticing! I think that you had it right the first time with $this->config->urls->NewsletterMailChimpSync (rather than paths, which represent server disc paths, not relevant to stylesheet links). However, if you add parent::init(); to your init() function, and name your CSS file (or JS file) the same as your module name, then ProcessWire will load them for you automatically--this is the preferred way to do it.
-
For safety, good to sanitize the categories before putting them in the selector too: $selector = "id="; foreach($input->post->categorylist as $value) { $selector .= ((int) $value) . '|'; } $pages->find(rtrim($selector, '|'));
-
Can you describe more about the repeater? Maybe a screenshot of what it looks like and/or what fields are in it. Does the front-end of your site iterate these repeater items?
-
I agree, I do this sometimes too (or something like it)
-
Thanks for the follow-up, glad that you were able to find a fix for this. That rewrite rule you came across is just one to keep everything closed off in /site-default/, since that holds pre-installation files and generally doesn't exist after the site has been installed.
-
I'm not sure that I understand the question 100%, but am thinking you might be thinking of "hidden" as a type of field (like it would be in HTML), as opposed to a status that any field can have. In ProcessWire, setting the visibility to hidden can be done with any field and it's not related to the field type. That field will still be present in all of your API usage… it just won't be rendered in the page editor. So it's great for fields that you want to store things in from the API side, while excluding it from the interactive side.
-
This module installs a page on your Setup menu in the admin where you can manage comments (assuming you have a comments field installed). Download from the modules directory at: http://modules.processwire.com/modules/process-latest-comments/ Features include: Easily find the latest comments needing approval or moderation. Shows comments from all pages on 1 screen, paginated and in chronological order. Enables you to change the status of any comment, edit the text or delete. Filtering by status/type, cite, email or IP address Screenshot: I've been wanting to build this for a long time, and something like this should have been there from the beginning, as it's a bit tedious to keep track of all your comments on a large site without this. So this module may be moved into the core for version 2.3, in which case it'll be renamed to ProcessComments, so as not to conflict with those that may have this installed.
- 44 replies
-
- 11
-
-
Soma is correct that you can set the "visibility" to "hidden" in the field settings, and then the field can exist on the page but won't appear in the page editor.
-
Which module did you try to install? Do the errors persist even after restoring the default admin theme? What admin theme did the errors occur in? I'm not sure I've got enough understanding of the problem to know what solution to offer, so the more you can post about it the better (screenshots of the error messages might even help). But since you mentioned an issue that started as the result of installing a module, you've got me curious about what module could do this. One thing you might try is to go to the Admin > Modules and click "Check for new modules" as that will reset the cached module information. If you can't access that screen, let me know and I can tell you how to do it manually too.
-
You may also be able to setup an automatic sort by editing the repeater's template file and setting it under the 'Family' tab. Note that the repeater templates aren't visible in your templates list at first so you'll need to check the box to "show system templates" in the filter menu.
-
It's been awhile since I looked at this, but I seem to recall some issue with DOUBLE going back into PHP that wasn't an issue with FLOAT, so put it off to research later. I need to take a closer look again. But what you did by modifying the schema directly towards your needs is a fine way to go in this case. ProcessWire is not going to go and change your schema back or anything (unless you change the fieldtype), so it should be safe. But please let me know if you run into any issues with losing precision on the DOUBLE when going to/from PHP.
-
Repeater fields can't be cloned yet. I couldn't find a way to make it workable in the short term, so I set it to throw an Exception if you try to clone an repeater field (preventing the clone from happening). It could be that you have one of the versions between when repeaters were added and when the repeater cloning issue was discovered, so you may want to upgrade to the latest. Though let me know if this is occurring even on the latest version. But I think that's very likely the issue, and that you need to create those fields without the clone. Please let me know what you find.