-
Posts
2,778 -
Joined
-
Last visited
-
Days Won
40
Everything posted by Macrura
-
well i picked up the idea from Soma to always have a 'tools.inc' file in my template folder. Then in that file i paste in the code to run, load that page, and the commands execute. I'm keeping these various snippets in codebox snippets. I agree that this method seems a little arcane, but it works well; makes it very easy to manipulate your data...just have to be careful since you're mass editing.. Back in my joomla days i used nonumber.nl DB replacer, which enabled you to do this kind of thing, and be able to preview the changes to the data, which was nice; this PW api technique is more powerful though; i make a lot of backups to my sites when i'm working on them, so in the event something goes awry i can revert.. so to sum up - YES! it would be great to have this in the backend, and even be able to preview the changes.. if someone out there likes to write a module...i would support it in any way i could.
-
know this is kind of obvious, but the last time i did that i just ran a replacement on the content with the api.. <?php $ps = $pages->find("template=basic-page"); foreach($ps as $p) { $p->setOutputFormatting(false); $new = str_replace('mysite/', '', $p->body); $p->body = $new; $p->save(); } ?>
-
nice diogo - +1 for little dragon how bout this: http://grooveshark.com/#!/artist/Holy+Ghost/566436
-
Similar to Repeater - Custom Fields not fixed to template?
Macrura replied to nexflo's topic in General Support
set all of your templates, except 'home' or whatever you're using there, to disallow children. -
Wow horst - that is super awesome; I'll have to revisit this, because i need something like this for a site i'm currently working on, where there is a product and we want to generate a slick product sheet, downloadable pdf using the existing PW content and images...
-
might be cool at some point to have a pw user survey
-
@pwired - +1 for getting a percent up front, and then keep the site on your development server until you get paid in full.. i put a coming soon page in the client's domain and then once the site is done, they need to pay the balance before the site is installed on their domain..
-
what about a simple string replace on the search results (get rid of leading the, an, a).. $sort_title = preg_replace("/^(the¦a¦an)\b\ */i", "", "Some title");
-
How to do this in PW - modx ditto stuff
Macrura replied to OllieMackJames's topic in Getting Started
also, can't you do this: if ($count % 2) instead of this: if ($count % 2 == 0) or maybe bitwise - supposedly faster if ($count & 1) -
thanks ryan - i was wondering about that - guess i should clean up my example, and pull out some of the site-specific markup, to make it a better example;
-
i've done that a lot, how you described; but i think diogo is making a good point that there's really no need to be economical in terms of # of fields or templates you use, especially if it makes it easier/cleaner
-
Getting fake URLs (with UrlSegments) returned in search results
Macrura replied to adrian's topic in General Support
note this is untested, and i haven't used clone before...but i think you are looking for something like this (though this needs help from a real php person) <?php $results = $pages->find('title|category.title%='.$config->input->get->q); $people = new Pagearray(); foreach ($results as $result) { $cats = $result->categories; foreach($cats as $cat) { $result = clone $result; $result->category = $cat; $people->add($result); } } ?> -
ok here's something pulled straight from a place i did this: <?php $gallery = $page->images->findTag('gallery'); if(count($gallery)) { ?> <!-- start gallery --> <?php foreach($gallery as $image) { ?> <!-- image markup here --> <?php } //end foreach ?> <!-- end gallery --> <?php } // end if ?>
-
Getting fake URLs (with UrlSegments) returned in search results
Macrura replied to adrian's topic in General Support
i revised this since it's a bit more complicated that i first tried, as far as adding the pages to the array for each tag... will post back later... -
yeah, i've done this with lightbox galleries, give the image a 'gallery' tag and it shows in a lightbox on the page...tags rule
-
a lot of examples of the URL segments when organizing content by tag, or category; i think it is ok as long as you have the canonical. plus if there is no way for a user to get to the 'real' url, then you don't really need to worry about it; it sort of comes down to the specific situation... it does speak to the flexibility of the system that you can basically write your own url router, using the segments feature...
-
<?php $lastProduct = $productList->last(); $counter = 1; foreach ($productList as $product) { if(!$counter % 2) echo "<div class = 'row'>"; //item is odd, so open the div.row echo "<div class = '6-columns'> <div>$product</div> </div> "; if ( $counter % 2 || $product == $lastProduct ) echo "</div>" ; //item is even (or list is complete), so close the div.row $counter++; } ?>
-
this is possible using URL segments; I think this really depends on what your specific need is; if you use URL segments, then you'll have duplicate URLs (so use canonical meta tag pointing to the actual page location).. to make it work, you would enable URL segments on the template being used on the skycrapers page; then you run a check to see what is in the url, and then return the data for the page that matches; you can find a lot of examples in the forum.
-
thanks for posting this Matthew... i'm working on a similar concept involving kids and the performing arts, this is good inspiration..
-
just to clarify: the number of sections is variable each of those sections can choose from 1 of 3 'layouts'; and each of those sections+layouts can accept 4+ types of content. in addition there is a possibility on a page, to include a 'reusable' block, in any of the said positions. thinking about the structure of PW, it would seem that the best way to think of your sections is in fact with pages; because then your users can select a different template according to the type of content; then when they are inputting/editing that content, you could provide a select for them to choose between the three layouts. When rendering each section, you could then easily include the necessary template for that item into the main page, and the from that include file, include the specified layout, or use classes to control the layout, use an if to check which layout they selected. if it is not too complicated with the different content types, you could setup functions to render each content type, like with an include file containing all of the markup for each section.. (i'm not a super php guru, so this code may not be the most efficient...) function renderSectionArticle($item) { $out = " <div{$item->class}> {$item->some_field} </div> // etc "; return $out; } in the template $items = $page->children; foreach($items as $item) { if($item->template == 'article') echo renderSectionArticle($item); elseif($item->template == 'something') echo renderSectionSomething($item); // etc... } this would seem to solve 1, 2, and 3. As far as how intuitive this is, i think that's really just a matter of users getting used to the system, and I wouldn't bother hacking the admin; the only disadvantage might be in not seeing the page as a whole when editing each of the separate pages. I use this method a lot, meaning i have a page which is composed of various elements, each stored in a child page. As far as including that reusable block, that is something that might be best to be selected in the parent item; you could provide a page list select to choose the reusable item, and then have some way of specifying the order. You could use the import array to get that reusable section into your child pages array; then you could sort that array on a custom field, such as 'section_order' where you specify in that field the hierarchy; you could sort the pages in the admin based on that field; they wouldn't see the reusable section though in the admin, but it would appear in the right place on frontend..
-
Can I limit page editing to the user that created that page?
Macrura replied to tinacious's topic in General Support
will the created pages be random throughout the site, or could each person's created pages be children of a certain page? if the latter is the case, maybe use page edit per user to limit access to that parent page; if page edit per user could maybe be modified to also limit child pages... -
the best way to learn how to do the dropdowns search is to download and have a look at the skyscrapers profile; it's all in there, and i just built a site with advanced product search (dropdowns, field, calculations etc..), based off of the code in skyscrapers
-
nice site Joss...and it should be easy to fix those validation errors.... one of the things i always do is constantly check my markup output of templates with the validator, since it often finds things like missing alt, duplicate IDs, unclosed divs....even if you're really careful, sometimes when doing a complex layout with includes, things can get messed up..
-
YAY!
-
it would be great if all the module creators hooked up github <-> flattr, would make it easy to give back a little..maybe pay for some expenses