Jump to content

Macrura

PW-Moderators
  • Posts

    2,776
  • Joined

  • Last visited

  • Days Won

    40

Everything posted by Macrura

  1. it's actually really easy to use a wordpress theme for PW; but you do have to have access to the output; so if there is a demo, then you can see the generated markup; you would just need to point the assets to the correct place and it should all work; I've used some pretty complex WP themes so far with PW.. main thing for me was coming up with a good way to generate the right body classes, so i have a function for that..
  2. it's really hard to tell what's going on - could you provide the exact directory structure and where PW is, and how you have configured the domain name to point to the folder containing the PW install? looks like PW may be getting tripped up because of where the folders are? this is the needle: $f = dirname(realpath(__FILE__)); so it can't find the realpath because of some server config;
  3. hey, not sure, but maybe you need to do this? RewriteBase /
  4. the only things i can really suggest is try creating another new page under an existing page, like the example about page. if the other siblings show but the new page doesn't show then it's either unpublished, or you have some markup that is causing it to fail but if you make a new blank page using an existing template then it should show up. you may also need to test by removing the redirect temporarily.
  5. Same problem here, Samsung Galaxy note
  6. let's clear up some terminology a lot of people call menus tabs. But i'm sorry, they are not tabs, or anything close to or related to tabs. It's not your fault, and a lot of my clients say 'tabs' and i have to reply 'do you mean the menu?' so when you choose to view a page, using the main navigation, something is going wrong. it depends on whether the rewrite base rule is correct. is your domain in the root? what is the URL of the child page you are not seeing? are there any server error logs, or any processwire logs? have you installed the diagnostics module and checked the server environment, to make sure it meets the requirements? have you created any new templates in the admin? for example, have you created a new page called contact, using some self-created new template, but not added that template to the templates directory?
  7. for now i'm using the method that Wanze posted, and it is working fine... along the way of this project i may test it with a normal array..
  8. shouldn't be that hard; i've done some similar things with complex displays really similar to that. this is untested and assumes a lot, not knowing the names of fields etc.. <? function listMovies() { // get all of the movies $movies = wire("pages")->find("template=repeater_movie_times") $dates = array(); $out =""; // find the array of dates for all movies foreach ($movies as $movie) { $dates[]= date("U", $movie->getUnformatted("date")); } $dates = array_unique($dates); asort($dates); // for testing // print_r($dates); // print_r($movies); foreach($dates as $key => $date) { $dateDisplay = date("l, F jS", $date); // l = A full textual representation of the day of the week // F = A full textual representation of a month, such as January or March // j = Day of the month without leading zeros // S = st, nd, rd, th // Output the date $out .="<h2>{$dateDisplay}</h2>"; // find the array of movies this day and put into new array $date_movies $date_movies = $movies->find("date=$date"); // print_r($date_movies); // loop through the movies for this day and add the times to the array $times = array(); foreach ($date_movies as $date_movie) { $times[]= $date_movie->start_time; } $times = array_unique($times); asort($times); // print_r($times); // loop through the times and find movies for the time foreach($times as $key => $time) { // Output the time $out .="<h3>{$time}</h3>"; // filter only the movies for this time, from the $date_movies array. $time_movies = $date_movies->find("start_time=$time"); // print_r($time_movies); echo '<ul>'; foreach($time_movies as $m) { $movie = $m->getForPage(); $out .="<li>{$movie->title}</li>"; } // end foreach movies echo '</ul>'; } // end foreach times } // end foreach dates return $out; } ?>
  9. your options for a slider are several.. here are two common options: 1.) Repeater - the repeater is a type of field that can repeat the same content pattern over and over on a page. You can specify which fields to use in the repeater. repeaters are really pages, that are just hidden from the normal page tree. I was just working on a site where their homepage slider is done with a repeater. You don't hear much about them now that there is Page Tables, tables, and profields multiplier; however repeaters are still an indispensible part of the the PW toolkit and when used for the right purpose are great. 2.) Pages, and PageTable You can setup a hidden branch of the page tree (e.g. settings) and below that store various things, one of which could be sliders; so you would have something like: /settings/slider/slide1 /settings/slider/slide2 the template for slider could be called 'slide-folder', or 'slide-index' and then template would be 'slide'. your slide template would have whatever fields you need. the slides themselves will be added by the pagetable field Next you would setup a pageTable field called slides and you would specify that the new slides are added to that /settings/slider/ branch.
  10. cool... will do some testing and report back; wondering if this should be documented somewhere, because i can see people assuming that the WireArray would differentiate images with the same name if they were keyed to different pages..
  11. the only thing worth mentioning with Piwik is that since it is self hosted, if you have some other sites using it (i have a lot of sites all using the same piwik install), sometimes i have noticed a delayed page load on some sites while it waits for the piwik server to respond; maybe there is a way for me to configure this better, but i would guess that if you are going to use piwik as a personal analytics server, to have it somewhere on the cloud to avoid loading delays on the referencing sites..
  12. I think i may actually require that these go directly into WireArray, because when they are being output, i am using a lot of the properties, like $image->page, and then all of the inherited fields of the page that the image was pulled from; if i were to put them into a plain array, i would lose the $page property... maybe there needs to be a parameter for import which allows duplicates, especially in the case of page images? EDIT: or maybe your example does preserve the properties, with the getArray() ? will have to get more up to speed on that..
  13. I was using import - is that the reason why it was de-duplicating on the file name? this is the code $productImages = new WireArray(); foreach( $page->children as $p ) { $productImages->import($p->product_images); } $productImages->import($page->product_images_master);
  14. came across a strange edge case; I'm creating a new WireArray to collect images from various pages, which all get output into a gallery. In this particular site, the client had several images all with the exact same name on different pages, and when those were imported into the WireArray, they are de-duplicated, even though they are different images on different pages, so those images were not showing. I worked around it by renaming the images on the fly, and i can use the custom upload names to prevent this from happening in the future, but it does seem like someone else might run into this, not realizing that the wireArray is assuming the same named images are the same on import; i guess maybe i could have imported them into the wireArray using this syntax? $key = 0; foreach($p->product_images as $image) { $productImages[$key] = $image; $key++; }
  15. that's pretty strange...have you tried copying out the entire text of the page 2 into a text editor and then pasting it back in?
  16. yes, you'll have to do some additional checking in the function - i usually would add additional conditions, something like this: <?php class SiteUtilities extends WireData implements Module { /** * Basic information about module */ public static function getModuleInfo() { return array( 'title' => 'Site Utilities', 'summary' => 'Various utility functions', 'href' => '', 'version' => 1, 'autoload' => true, 'singular' => true ); } public function init() { $this->pages->addHookAfter('save', $this, 'AssignCatToSubcat'); } public function AssignCatToSubcat($event) { $page = $event->arguments[0]; if($page->template != 'thing') return; if($page->cat == '') return; if($page->subcat == '') return; $category = $page->cat; $subCategory = $page->subcat; $subCategory->setOutputFormatting(false); $subCategory->cat = $category; $subCategory->save(); } }
  17. should be really simple; this is untested, but this is basically the idea: <?php class SiteUtilities extends WireData implements Module { /** * Basic information about module */ public static function getModuleInfo() { return array( 'title' => 'Site Utilities', 'summary' => 'Various utility functions', 'href' => '', 'version' => 1, 'autoload' => true, 'singular' => true ); } public function init() { $this->pages->addHookAfter('save', $this, 'AssignCatToSubcat'); } public function AssignCatToSubcat($event) { $page = $event->arguments[0]; if($page->template != 'thing') return; $category = $page->cat; $subCategory = $page->subcat; $subCategory->setOutputFormatting(false); $subCategory->cat = $category; $subCategory->save(); } }
  18. yeah, that actual posted module should work once you change the names of the templates and fields; i have that working on live sites
  19. this is a common situation; you have a page field, and you create a new page by adding the options there on the ASM select, but you need some other things to be configured on that page, in your case the category). concerning your first request - the title, that should be set by the option you have entered, as long as you have configured it that way; but if you need more options those can be adjusted on page save using a module; here is an example which you would need to put into a module; for example, i always have a generic 'SiteUtilities' module where i can throw in all kinds of generic stuff without having to make multiple modules, and worry about installing them or keeping track of them; <?php class SiteUtilities extends WireData implements Module { /** * Basic information about module */ public static function getModuleInfo() { return array( 'title' => 'Site Utilities', 'summary' => 'Various utility functions', 'href' => '', 'version' => 1, 'autoload' => true, 'singular' => true ); } public function init() { $this->pages->addHookAfter('save', $this, 'AssignSubCategory'); } public function AssignSubCategory($event) { $page = $event->arguments[0]; if($page->template != 'someTemplate') return; // the template where you want this to run $category = $page->category; // this would be your category field $subCategory = $pages->get("something"); // this would be the page that is the sub-category foreach($category as $c) { if($c->template != 'category') continue; $c->setOutputFormatting(false); $c->sub_category->add($subCategory); $c->save(); $this->message("Sub-category {$subCategory->title} added to Category{$c->title} "); } } } // end class
  20. i did have the save to 404 error a few times; it was totally random when it happened; i believe it was a mod security issue with my host.
  21. @laban, just change the page select from a multi to single and it should fix your issues
  22. there's really nothing to it... you just need a way of rendering the objects, like a function or include file, or template render; I have a site that i do an isotope 'wall' homepage, and it pulls in all of the site content, and renders each wall item with a different function depending on the template of the page.. the isotope/masonry is pretty well documented and easy to use, if you're planning on using that;
  23. i don't get this: $menuname = $page->show_menu->select_value; if you want the name then it would be: $menuname = $page->show_menu->name; you could also setup a fallback in case you haven't made show_menu required, like: $menuname = $page->show_menu->name ?: "home-menu"; oops - almost forgot: welcome to the forums, and to processwire!
  24. some guesses: 1.) is $page defined where you are doing this and does that page's template allow the new page to be a child of it? 2.) maybe original-page needs trailing slash?
  25. i don't think ProCache is overwriting the header - i think that it is serving the file that is generated from a .html file in the cache, and since those files are .html , they will always be sent as text/html; would be curious if there were some magic htaccess way to make it work
×
×
  • Create New...