- 
                Posts868
- 
                Joined
- 
                Last visited
- 
                Days Won1
Everything posted by DaveP
- 
	You're a machine, Ryan. Just found that there is a preview that supports Win7, so downloaded it earlier (huge download) but it requires a restart so it'll have to wait.
- 
	That's great - thanks Ryan. As for browser support, my experimentation over the last few days suggests that they are supported by at least the latest versions of Chrome, Firefox and Opera on Windows. Not IE, obviously. Safari on Mac doesn't seem to either, oddly. PCRE compatibility I'm less sure about. What I do know is that this regex generator produces patterns that work, and delights like [A-PR-UWYZ0-9][A-HK-Y0-9][AEHMNPRTVXY0-9]?[ABEHMNPRVWXY0-9]? {1,2}[0-9][ABD-HJLN-UW-Z]{2}|GIR 0AA) work (UK post code).
- 
	While I more than welcome the inclusion of 'Required' and 'Placeholder' support for input fields, I think one element that would be very useful would be 'Pattern' support. (Just in case anyone isn't aware, modern browsers can validate input based on a regex.) Of course client side validation is no substitute for server side validation, but the same regex can be used server side, too.
- 
	Wow, 2.3 is getting some seriously powerful new features. (I already sneakily grabbed the new version of the Comments Module and it's great.)
- 
	Post to the actual page url so something like <form action='<?php echo $config->urls->root; ?>forms/mailer/' method='post'> or whatever.
- 
	Aah, my bad. Put this somewhere before the code in my earlier post. <?php $homepage = $pages->get("/"); $children = $homepage->children; $children->prepend($homepage); ?>
- 
	This is from a working site that uses Bootstrap. (The only caveat might be that it might be an earlier version of Bootstrap.) <ul class="nav"> <?php foreach($children as $child) { if($child->numChildren > 0 && $child<>$homepage){ $class = $child === $page->rootParent ? " active" : ''; echo "<li class='dropdown$class'><a href='#' class='dropdown-toggle' data-toggle='dropdown'>{$child->title}<b class='caret'></b></a>"; echo "<ul class='dropdown-menu'>"; foreach($child->children as $grandchild){ $class = $grandchild === $page ? " class='active'" : ''; echo "<li$class><a href='{$grandchild->url}'>{$grandchild->title}</a></li>"; } echo "</ul>"; echo "</li>"; }else{ $class = $child === $page->rootParent ? " class='active'" : ''; echo "<li$class><a href='{$child->url}'>{$child->title}</a></li>"; } } ?> </ul>
- 
	Is there anything in PW's error log in /site/assets/logs/ ?
- 
	And it's very lightweight (under 1000 bytes) cousin tCycle http://jquery.malsup.com/cycle2/tcycle/ which must be the easiest-to-implement image fader available.
- 
	...active (>100 posts) forum member who gives their location in their profile -
- 
	I love GA. One quite interesting trend from the country analysis... All the countries with <25% new visits have (or have had) at least one (very) active (>100 posts) forum member - Finland - Antti, teppo Switzerland - Oliver Slovakia - Sevarf Portugal - Diogo Sweden - formmailer Croatia - Nikola So if they weren't so active, things could be somewhat different.
- 
	Since the images don't have to be in an image field, what about a logo repository (/site/templates/logos/) and three fields (image_url, description & url) on pages created by csv import module?
- 
	...and adding description and URL : + 4min 58 sec
- 
	Could you not use pages? FWIW I'm starting to do this kind of thing more often - create a template with the fields you need but don't make a template file. Then you can use PW's selectors (with eg template=logo). We don't use 'leverage' for 'use' in the UK but you know what I mean.
- 
	Here's a bit of code that you might find useful. It's something that I referred to earlier in this thread. Say you have a group of pages that represent businesses - like entries in a business directory. Put something like this at the top of your template for each business. <?php $siblings = $page->siblings(); foreach($siblings as &$sibling){ $pagetext = strtolower($page->title.' '.$page->city.' '.$page->postcode); $siblingtext = strtolower($sibling->title.' '.$sibling->city.' '.$sibling->postcode); $stopwords = array('limited','shop','emporium'); $pagetext = str_replace($stopwords,'',$pagetext); $siblingtext = str_replace($stopwords,'',$siblingtext); similar_text($pagetext, $siblingtext, $sim); $sibling->similarity = $sim; } $siblings->sort('-similarity'); ?> $stopwords are words you want to be ignored in the comparison (in my real-world use they are business-specific terms that a great many businesses have in their names). Then to display a list of similar entries... <?php $score = 40; if($siblings->eq(1)->similarity >= $score){ echo '<h3>Similar Entries</h3>'; echo '<ul>'; for($i = 1;$i <= 10;$i++){ if($siblings->eq($i)->similarity < $score) continue; echo "<li><a href='{$siblings->eq($i)->url}' title='{$siblings->eq($i)->title}, {$siblings->eq($i)->address}, {$siblings->eq($i)->city} {$siblings->eq($i)->postcode}'>{$siblings->eq($i)->title}</a>"; if($user->isSuperuser()) echo ' '.round($siblings->eq($i)->similarity, 2); echo "</li>"; } echo '</ul>'; } ?> Adjust $score to get satisfactory results. (And the bonus prize is that logged-in super users get to see the score in the page output.)
- 
	Well, you learn something every day. I didn't know that existed. (So, obviously, hadn't changed it.)
- 
	Doesn't sound dissimilar to a problem I had today - mine was a case conflict - lower on one version and PascalCase on another.
- 
	5.3.8 on wamp, 5.2.17 on web server. (Should probably try to have them match )
- 
	Not my day, today. Just transferred site to web server and had a couple of problems. Everybody's favourite - 'unexpected T_PAAMAYIM_NEKUDOTAYIM' at line 16 of PaymentAbstract.php, so I changed the '::' to '->' and that seems to have worked. (PHP version difference?) DB ShoppingCart not found. It's shoppingcart on my dev system (Windows) but the server (Linux) appears to prefer ShoppingCart. Am I likely to have broken anything? Is there anything else I need to do? (Everything does appear to work now.)
- 
	Thanks apeisa, I got the site 'done' over the weekend (enough to show it could be done, anyway). It was an absolute breeze (apart from my daft cockup), and your modules are very impressive. Don't know if the site will ever go live, but if it does, I'll post a link.
- 
	Found it - my fault. I'd called the template sc_checkout instead of the correct sc-checkout.
- 
	Title says it all, really. I don't know what I have missed - all the modules are installed and set up, Checkout page exists and has the correct template etc. I know it does work, because Luis has it working on his site. Can anyone offer any suggestions?
- 
	Thanks, WillyC & Soma, that's great. I'm using a framework (foundation.zurb.com in this case), so your examples help me to output the appropriate markup.
- 
	http://wiki.processwire.com
- 8 replies
- 
	- 1
- 
					
						
					
							  
 
- 
	
		- best practices
- production environment
- 
					(and 1 more) 
					Tagged with: 
 
 
- 
	This is really interesting stuff and I'm learning so much from it. I've already tested Soma's code and it works very well. Is there a way of configuring $form->render() so that it outputs different html (divs for ul/li etc.)?
 
            
        