Jump to content


DaveP

Member Since 26 Jan 2012
Offline Last Active Today, 11:11 AM
-----

#35542 Prevent form resubmission

Posted by DaveP on Yesterday, 07:10 AM

Flashdata thread http://processwire.c.../970-flashdata/




#35439 Prepros

Posted by DaveP on 21 May 2013 - 08:17 AM

Looks very interesting - http://alphapixels.com/prepros/

 

(Windows only)  :P




#35054 Security in WebDev (articles)

Posted by DaveP on 16 May 2013 - 03:42 AM

http://security.stackexchange.com/ is well worth a browse in a free moment.




#35052 Actually the CheatSheet Page is empty!? - Anyone else ...

Posted by DaveP on 16 May 2013 - 03:41 AM

Me too.

 

 

(At last, a semi-legitimate 'Me too' post!) 




#34973 ProcessWire on the web

Posted by DaveP on 15 May 2013 - 05:04 AM

I love this translation 

 

beautiful conclusion:
  • if you understand concept page, you understand ProcessWire



#34752 When logging in to Admin getting unable to generate password hash

Posted by DaveP on 13 May 2013 - 09:51 AM

Forgive me if I misunderstand the problem, but are you aware of the $config->userAuthSalt setting in config.php?

 

/**
 * Installer: User Authentication Salt 
 * 
 * Must be retained if you migrate your site from one server to another
 * 
 */
$config->userAuthSalt = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';

 

(Around lines 223-229 of config.php (near the bottom, anyway)) :)




#34055 Get all pages of template created this month?

Posted by DaveP on 02 May 2013 - 07:56 AM

I think 

$pages->find("template=invoice,created>".strtotime("1 ".date("M")))

 

should find invoices created this month. You'd need some extra logic for past months, but strtotime is the key.




#33957 Variables in page->find

Posted by DaveP on 01 May 2013 - 03:24 AM

micro-optimizations like these are a) futile

 

Can't recall where I saw it, but earlier this week someone suggested that finding a way to remove 1 jpeg from a site design is the quickest and easiest optimisation possible.




#33224 Question about missing ?>

Posted by DaveP on 18 April 2013 - 03:15 AM

For what it's worth, I always put semicolons after even single lines, not so much in the case @pwired cites above, but in more general cases. Say I have this 

 

<?php $foo = "bar"; ?>

 

and then I realise I need to add another line

 

<?php 
$foo = "bar"; 
$baz = "qux";
?>

 

I don't need to remember to add a semicolon to the first line when editing to add the second line, because it's already there.




#33093 Simply Interesting for ProcessWire

Posted by DaveP on 16 April 2013 - 09:34 AM

http://wonder-tonic....rocesswire.com/ or indeed http://wonder-tonic....or-processwire/

 

(2nd one is a bit meta)




#32847 Display a list based on custom field

Posted by DaveP on 13 April 2013 - 06:37 AM

You'll need to close the foreach, so something like this will work

 

<?php $drinks = $pages->find("template=drink"); ?>
<h2><?php echo $page->title; ?></h2>
<ul>
<?php foreach($drinks as $drink): ?>
<li><?php echo $drink->title; ?></li>
<?php endforeach; ?>
</ul>

 

Note that I've used a colon ( : ) after the foreach and then closed with endforeach. You could use foreach(){ and then <?php } ?>, but endforeach makes it clearer where the loop finishes (and which loop it is). Bit more info here.

 

Edited re @nik's comment below and to change the colon back to a colon from being a smiley. 




#32635 How to use checkbox value to output data?

Posted by DaveP on 11 April 2013 - 10:05 AM

I think it should be 

$settings = $pages->get("/site-settings/");

 

ie get [one page] rather than find [any number of pages]

 

(and you don't need the == 1 in the if because if $settings->mycheckboxfield is 1 then it will evaluate to true.)




#32594 Does This Website Render Properly in IE8?

Posted by DaveP on 11 April 2013 - 04:15 AM

Using IETester, it gives loads of script errors, but most (all?) of them seem to relate to ThemeForest. The theme itself (http://pixel-industry.com/html/alexx/) seems to work tolerably well in IE7 and very well from 8 upwards.




#32403 Searching and repeaters

Posted by DaveP on 09 April 2013 - 10:54 AM

$contracts = $page->files->find('description*=Contract');
$catlist = $page->files->get('description*=Cat List');

 

Are a couple of lines from an actual intranet app we use at work.




#31573 The Future?

Posted by DaveP on 01 April 2013 - 10:15 AM

http://www.intercaloninterstates.org/