Jump to content

Craig

Members
  • Posts

    377
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Craig

  1. Is that blue highlighted line, line 32? Try it like this instead: return '<ul>'.do_print_categories_list(explode("\n", $cats), array(0), array(), $cat_params).'</ul>';
  2. You would link multiple users in a similar way - new Page field called users, configured for "template=user", and use the "Multiple pages (PageArray)" option on the field Details tab, and add to the event template. The difference in code would be this: <?php // Loop through all users added to the page. foreach ($page->users as $u) { // Use $u (or whatever you like) but not "$user" - it is a ProcessWire system variable (current logged in user). echo $u->name . " is a member of this event.<br>"; } ?> Locations with the same name would not be permitted to have the same direct parent - so the name would have to be changed when adding it. Each page still has its own ID, name and path which can be used to identify and load them within code. For example: ID: 1042 Name: concert-hall Title: Concert Hall Path: /locations/concert-hall/ The ID cannot be changed, but the name can. And the path is built up based on the name of the page and the names of it's parents. By default, names are automatically generated from the title field value, but can be overridden if necessary, generated yourself, or automatically using datetime values.
  3. Hi tehandyb There is a rough translation between traditional terms and ProcessWire's, which is: Templates = tables Fields = columns Pages = rows Template files = controllers & views In ProcessWire, you would create the necessary fields for your content, add the to one or more templates (to define your "schema" in a way), and you create pages based on those templates. The page output is handled by it's template's file. The fields you add to the template can vary from integers to text input to map markers (and more). In your example, you would probably want to create templates for at least event and location. Users, roles and permissions already exist in PW, but you can extend these for your own needs if you have to. The key to linking pages together (individual users, locations and events) is the Page fieldtype. This allows you to create a field that can reference one or more other pages of a type of your choosing. Back to your example, I'm going to presume an event might have one location or none at all. First, create a location template with the basic fields you need. Create a section of your page tree to store them. If you don't want them to show up in lists or searches, set the parent to Hidden. Then, create a new field called location and add it to your event template. Configure it to list pages with a template of location and the parent page where they're stored in your tree. You can also choose what type of inputfield it will use - a Dropdown or PageListSelect might be appropriate depending on how many you have. When you have done that, creating or editing an event will allow you to choose a location from the list. In the event template file, you would access it like this: <p>This is the <?php echo $page->title ?> event.</p> <p>The venue is: <?php echo $page->location->title ?>.</p> I'd recommend reading some more documentation and this brilliant thread on categorising your content.
  4. I don't think you will need to touch the core at all here. The code you mentioned is part of the ___setupNew() function. The underscores prefix mean it's hookable. This means you can create a module with your own function that runs before, after or to replace that one. You can find out about how to do that here: API - Hooks.
  5. This is a very nice admin theme, thanks very much for sharing it
  6. Craig

    Lister

    PW 2.4.4 on the dev branch...
  7. Hi xvda Please feel free to have a look at the code for my LoginPersist module, where I create a hook for Session's authenticate() method for that request. I store a temporary password for the user in the session, and in my hooked authenticate() I check the temporary one rather than the one in the database, and return true if it matches. I've also created a TwitterLogin module (like the Facebook one you're using) using the above method, but it hasn't been fully tested yet. You're more than welcome to have a look at it though.
  8. Yes, select the database first from the left menu. Then you can either click the SQL tab, paste in the code and click Go. Or click on the desired table on the left menu, then click the Operations tab, and change the value in the field as mentioned by adrian.
  9. Which shop system is it? Some systems (e.g. Magento) use separate tables that keep track of auto increment values and also have to be updated if this value is changed manually.
  10. Hi John. ProcessWire will be able to handle all of that rather well This is how I would think about doing it... Students and users If you want some projects to only be accessible to students, then certainly add students as users. You can extend the "user" system template with additional fields for your extra data. Create a new role "student" to add to these users and to control permissions. User title (For full name) name (permanent ProcessWire field - use this for student ID, perhaps?) programme (FieldtypePage, for programme of study) year (FieldtypePage or FieldtypeInteger) Projects title body (FieldtypeTextarea) images (FieldtypeImage. For images only) files (FieldtypeFile. For video or audio) students (FieldtypePage. Allow multiple. Use a custom selector value: template=user, roles=student) programme (same FieldtypePage as above) Each project would have their own page under a parent "Projects" page. For the Programme of Study, presumably this is just a simple lookup/dropdown list? A common way of doing this in ProcessWire is to create a settings or configuration template (with minimal fields - usually just title) and (hidden) page tree. E.g. /settings/programmes/ |-- Programme 1 |-- Programme 2 |-- ... You can then create a Page field which will use something like template=settings, parent=/settings/programmes/ to allow selection of the programmes of study for both users and projects. This makes it incredibly easy to generate a front-end filter for the programmes and build a page query selector string to find projects that belong to the programme of study. Depending on the way you want to format or structure your year of study you could use the same process. But if it's just going to be the year in numeric format (like 2014) then you could just use an Integer type rather than a Page. With that structure, there shouldn't be any performance issues.
  11. From my understanding, as the script is always running, the initial request will get the page and it will be cached internally. Subsequent requests would then use the local cached copy instead of hitting the database. It looks like Page has an uncache() method which accepts a single parameter page ID. So you could replace your call with: wire('pages')->uncache($pageId);
  12. Many moons ago (pre-Chrome) I used Firefox as my main browser. I enabled functionality (in about:config I think) which allowed the focusing of links using the keyboard. So you would press a key, start typing the text of a link on the page, and it would focus it so you could activate it by pressing Enter (Sort of like Ctrl+F but for links only). That was brilliant and I used it a lot, and I have never been able to find something like that for Chrome. This looks like a perfect replacement for that though, so thanks very much for finding and sharing
  13. That sounds like a great project To make the UI a bit more organised with those fields, you could also break them up into tabs using a FieldsetTab (already available - just add new field "FieldsetTabOpen" and add to templates), and put fields in columns using AdminTemplateColumns. It might make sense to use inputfield dependencies to show and hide inputs based on certain conditions. Page reference fields: you should probably use these for categories, but you could also use them for size, colour or other product variations as well.
  14. Does the search or search results template have any caching enabled on it?
  15. It's looking good Ben Couple of observations: The work filter is very nice The line length on the work detail pages is a bit long for that font size. Perhaps put the main work image on the left/right side of the main body of text? The left article flyout effect was a bit confusing the first time I saw it, as it was unexpected. (I wanted to click the sausage/hamburger menu but hit the top colour block instead)
  16. Hello! I am currently building a personal site where I want to add social logins. I couldn't find a module that handled Twitter so I started building the functionality from scratch. It started off as just a couple of separate functions, but is more suited to being a module - so here it is! It is somewhat based on apeisa's Facebook Login module, but uses a third party tried-and-tested Twitter OAuth library, as well as an additional configuration option, a hookable update method and a different way of doing the PW authentication. So far, I have developed and tested this on ProcessWire 2.3 and 2.4. I would welcome any feedback, comments, suggestions and problems from others interested in this. Get it here: TwitterLogin on GitHub
  17. That all looks rather great! Excellent work, thank you
  18. I've implemented similar things before (not in PW, but still PHP/MySQL) and each item is its own entry. From that experience, it's a lot easier to filter on, personalise and scale, if you have an explicit container of items with their own reference for type of update, user, timestamp and so on. This should let you easily control the wording of the updates, decide if an update should actually be added or ignore it (e.g. prevent too many of the same type within a short space of time), and easily build in comments/like functionality.
  19. nico.codes, or more suggestions
  20. ProcessWire users can be front end users too, and that might be a good way to do it. But the admin will have to create users, and then add the user to the gallery using a Page reference field. Perhaps a more simple way of doing it would be like this: Create two new Text fields called login and password, and add to the template you use for the photo gallery pages. The admin can set and view these in the CMS. When the page is viewed, your template code should check the session or a cookie for presence of a certain value based on the gallery's name. If the value is not set, then present them with a login form only. When the form is submitted, check the submitted details against the page's login & password values. If they match, create a new session or cookie entry based on the gallery's name, and set a value (like "true" or 1 - just to indicate that the user can view the page). Redirect back to the photogallery page. Because you have set the session or cookie value, your check from step 3 above will be true - so instead of the password form, show the photos.
  21. From a security point of view, it would be better putting the requested page to redirect to it in the session anyway. Otherwise, malicious users could send people to the wrong page just be specifying another ID in a link.
  22. If you replace the iframe map with the Google Maps javascript API, you have control over the "scrollWheel" map option which you can set to false, which will solve this problem.
  23. Check the .gitignore file in the root of your project, because the default ProcessWire one includes "site" - so everything in there is ignored.
  24. Thanks Martijn, that's not brilliant I'm just using Google Web Fonts (Raleway) and standard weights, so I'm not really sure why it looks like that. The only Apple device I can lay my hands on is an original iPad and it is readable in both Chrome and Safari. Life's too short to waste time debugging webfont issues so I've just removed it
  25. Thanks cstevensjr, Can Yes, it's using Pure CSS. The layout uses the responsive grid units (pure-u-*) nested as deep as necessary within rows (pure-g-r) to get the different parts to fit together and align properly. If you use the browser developer tools to inspect the DOM you should be able to see how they're all set up. The header and footer are just wrapper DIVs with the row (pure-g-r) inside.
×
×
  • Create New...