Jump to content

choppingblock

Members
  • Posts

    49
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by choppingblock

  1. unfortunately this only works the other way round than what i need... the field (left side of the operator) has multiple values, while the value (right side of the operator) has only one. what i need to accomplish is finding out if the value on the right side matches one of the field values. if i could just flip the operands... i can't think of an easy way to do this, but maybe someone smarter than me can...
  2. Hey all, i wonder if there is a way to imitate an IN() statement like "SELECT id WHERE field IN(1023,1208,2357)" I have a website where i have products assigned to categories, and each product can be assigned to multiple categories. The categories are (of course) pages, so the "categories" field of a product might look like "1034|1209|1508". The pages to display the products are also assigned a category (the products are not displayed on the category pages themselves), but this can only be one at a time. What I am trying to do is to find all products of a category and display them on a page... but I can't figure out how to do that. I tried $pages->find('category='.$page->category); but that didn't work, i think due to the fact that each page can have multiple categories. I would need something like $pages->find($page->category.' in category'); or $pages->find('category has '.$page->category); Is there already a way to accomplish this? Or should I use a completely different approach? Any help is appreciated. Thanks!
  3. if that is the only issue.. i will give it a go then. thanks!
  4. I just stumbled over this thread while looking for the best way to clone pages... Are there any news about the clone module working with multi language sites? I could really make good use of this in my current project...
  5. Drupal & Joomla ...the movie?? Part 6?!?! Man, i have to get my hands on part 1 - 5!!!
  6. this is what i was missing... thanks! Edit: Got it working with CSRF token, but I think the redirect approach fits better here. Easy to achieve with the flashdata function of PW (this should be added to the cheat sheet, I could imagine many users of PW would use this if they knew about it).
  7. this seemed not to work with my form, although it generates the token (i guess i have to check for it somehow after submit)... can you give an example of how you do this?
  8. You are probably right about Joomla... but I think even for experienced developers the time is spent better working with PW than trying to hack or extend Joomla. That is (for me) the absolute best thing about PW: the api is actually helping me to get things done quicker and easier, instead of forcing me to learn a new language or "hack the core".
  9. I am more concerned about people reloading the page (like, pressing F5) after the form has been submitted. So I'd like to redirect them to the same page, but without any POST data. And sending a flash message with the redirect (message that is only stored in the session until the next page is displayed). ...and there it is, thanks a lot.
  10. Thanks for the welcome... I noticed that a lot of people here came from MODx... there has been some discussion in the MODx community about where the CMS would go in the future. The reason for me to try PW was this article by Marc Hinse. I also had to do some projects with Joomla (hated every bit of it, and that was even before i learned about PW). I still don't understand why this is so popular... its un-flexibility is only matched by its un-intuitiveness.
  11. I have come to PW from MODx just a couple of weeks ago... before that, MODx (both Evo and Revo) was my CMS of choice and I always praised its flexibility (e.g. building page templates or adding code snippets was really easy, compared to most other CMSs). I still think that it is a good CMS (I have used it for years without finding a better alternative). Now that I have done some projects in PW, I doubt I will be going back to MODx. PW is much, much faster, has a very intuitive UI, a unique "the-api-is-everything" approach which allows instant production with just a quick look at the cheatsheet, and, very important, a small but incredibly helpful and friendly community. Thumbs up for PW!
  12. Hey all, I have just created a contact form with the PW api (nice and easy as expected, though I found it has some limitations concerning fieldsets and multi-row layout... I know this is a tricky subject, so no offense meant). I'm wondering what would be the best way to prevent the (accidental) resubmission of a form. I usually do this with a redirect after submit and a flash error/success message... is there any PW-ish way to achieve this (e.g., does PW support flash messages, or is this procedure even already implemented in the api somewhere)?
  13. Ok, I think I figured out what causes the issue. Seems that the old PHP 5.2.6 on my production server messes up the encryption/hash functions, so the Password::matches() method does not work as expected (on my local machine I have 5.3.5 ...which is rather old, too, as I just realized ). I'll try to udpate the PHP version and check again.
  14. is there any elegant way to do this except doing an update/replace within mysql?
  15. I made some corrections in the original post... hope this doesn't get too confusing. Maybe I will rewrite the whole thing when I have learned a little more.
  16. Okay... i made some progress, sort of. I transferred the site to a different server, and the login works now. The redirect again only worked when I was logged in... until I realized that I set the page to unpublished. Corrected that, works now. I still have to figure out what is not working on my production server... maybe it's a php setting or something.
  17. Still not working. Fresh install works ok, I can login as admin. Transferring the site files and db works, even the $session->redirect on the homepage. But as soon as I log out from the admin section, I can't login again and the redirect stops working. Arg.
  18. Hm. Does not work either... the Site Exporter Module seems not to work with a multi language site (i get a ton of error messages "unknown field: name1010"). I'll keep trying to figure out how to do it.
  19. I wonder why this is the case? Sounds like bug to me, I will have to try and duplicate. Has anyone else run into this? Unfortunately, I have no idea why this happens... it seems the creation of the additional fields in the pages table does not work. I'm unclear about why the homepage should be hidden and unpublished? The intention was to have the home page as kind of a switch for all the content pages... and redirect to the respective pages in the currently active language if needed. Thinking about this again, this is not necessary because there is a default language... From an SEO standpoint, I think it's a little better to let your homepage (root, no language segment) serve as the homepage for your default language. The thinking here is that people often link to your domain rather than a specific page in the domain. It's technically stronger to have those links resolve to an actual page rather than to a redirect. Absolutely right... this relates to the idea of having a language switch in the homepage (s. above) It's not another "good one", it's definitely a "much better one"! Thanks. I'll try to do some more research before posting in the tutorials section again...
  20. Hey, thanks for the replies... I will give the Site Exporter Module a shot when I'm back in the office on monday. Read/write I will have to do manually as I work on a windows machine (I know, I know... )
  21. Hey, so now my first PW site is ready to go to the production server, but something's not working. I have set up a new database, dumped my local database and imported it. I then copied all files to the production server, changed the db settings in the config file, made site/assets writable and emptied site/cache. The .htaccess file is in the root folder. The site is running, but: I have a $session->redirect($page->children->first()->url); in the home template, which is not working (displays a 404 error). And, even worse, I can't login to the admin page. I assume that this is somehow connected to a session error... but I can't figure out where to look. I did a fresh install of PW on the same machine and all was good, so it must be an issue related to the transfer. Any hints are welcome... thanks.
  22. Hi, i tried and started a first tutorial on multi language sites here: http://processwire.com/talk/topic/3473-how-to-set-up-a-multilanguage-site-using-a-single-page-tree/ It probably doesn't cover all aspects, but may be a good start.
  23. Hi all, I just switched to processwire from MODx and I am really impressed of how clean, fast and intuitive this system is. My first project with processwire happens to be a multi language site, and I am really happy that it can be done with a single page tree. However, I had to dig the forums a lot to find all information i needed to get everything working, so I thought I share my newly gained knowledge... The order of the steps is important, especially if you are working on IIS (which can inflict database damage if you add languages before you change the field types!) 1. Install the Language support modules: - Languages Support - Languages Support - Fields - Languages Support - Page Names 2. Change any existing Fields of types Textfield/Textarea/PageTitle to TextLanguage/TextareaLanguage/PageTitleLanguage You now will have an input field for each language you add. 3. Set up your languages under Setup->Languages (define a name and title for each language. For each new language, you will have to add a title to all the other languages in that new language) 4. Edit your homepage, set it to hidden and unpublished. UPDATE: don't set the homepage to unpublished, the first-child-redirect won't work! (I realized just now, because if you are logged in as admin, it does work) For each language, you have to define a unique name (e.g. "de" and "en") 5. Edit your "home" template to redirect to its first child: <?php $session->redirect($page->children->first()->url); UPDATE: this is not essential... as ryan pointed out, it might even be better not to do it (for SEO-optimization) 6. If you have something like $children->prepend($homepage); in the menu part of your head.inc, remove it (you don't want the home page to show up in your menu) UPDATE: if you left out the redirect option, you'll want to leave this out as well. 7. To switch languages, add this snippet to your head.inc: <ul> <?php $user_lang = $user->language; foreach($languages as $language) { $user->language = $language; if($language->name != $user_lang->name) { echo '<li><a href="'.$page->url.'">'.$language->title.'</a></li> '; } } $user->language = $user_lang; ?> </ul> Each language except the currently active one will be displayed in a list (of course, this can also be done with a select field). UPDATE: Ryan pointed me to a better solution for the langugae switch: http://processwire.c...s-urls/?p=33537 8. Done. Now your page urls should look something like path/to/root/en/my-page, or path/to/root/de/meine-seite It took me less than a day to set up processwire, install my html template and configure the site to be multi-language... this is so great, considering the pain multilanguage sites usually cause with all the other CMSs... Keep it up! UPDATE: I was a bit quick to post a tutorial just after one day working with PW... should have made some more research beforehand. Just got a little too excited there... I'm still impressed by the system and plan on digging deeper into it.
×
×
  • Create New...