« first day (3 days earlier)      last day (16 days later) » 

2:22 AM
Happy to help you! The code formatting trick: wrap your code in the back-tick character like this
Sigh, not working. dpm is executing on the correct rows, but 'new' is not applied to the row.
 
 
4 hours later…
6:14 AM
Because you use the variable as '$vars', but the correct usage should be '$variables'.
 
 
3 hours later…
9:44 AM
Nope, I took your example code, i.e.,
`function genesis_preprocess_views_view_list(&$variables) {
$view = $variables['view'];
if ($view->name == 'recent_news_widget') {
foreach ($view->result as $key => $result) {
if (time() - strtotime($result->node_created_day) < 14 * 24 * 60 * 60) {
$variables['classes'][$key][] = 'new';
/*dpm($variables);*/
}
}
}
}`
 
 
1 hour later…
10:51 AM
Try to dpm($key); and dpm($result); to see if they are delivered correctly under the foreach statement.
 
 
1 hour later…
11:51 AM
dpm($result) returns as it should; `
node_changed (String, 10 characters ) 1371174569
node_title (String, 26 characters ) Less than 24 day old story
nid (String, 3 characters ) 457
node_created_day (String, 8 characters ) 20130613`
dpm($key) increments, 0, 1 as I have to items in a 5 item list that match the date criteria. What's rendered is (snipped) ` <li class=""> `
 
12:35 PM
what if when you try:
dpm($variables['classes'][$key]); in the foreach statement, before you assign the new class?
 
1:31 PM
I get `Notice: Undefined offset: 0 in genesis_preprocess_views_view_list() (line 152 of /home/quantate/staging/sites/all/themes/genesis/genesis/template.php).` AND `<ul>
<li><pre></pre></li>
<li><pre></pre></li>
</ul>` html output. Line 152 is `dpm($variables['classes'][$key]);` just before the ` $variables['classes'][$key][] = 'new';` line
Funny that the backtick character no longer supports pre wrap?
 
So, that means there is no variables like $variables['classes'][0], $variables['classes'][1] defined.. It is strange, since, in my project where I tested, those variables were set.. Could it be possible that you might have unset those classes variables somewhere in your code??
Instead of backtick, you can use the option 'fixed font' which appears just next to the buttons 'send' and 'upload', after you make a line break with Shift+Enter.
 
As you can guess, I'm more front-end than back-end, so there's almost no custom code in use. I've been switching to the Bartik theme for testing to ensure no genesis-issue is creeping in. SO, it's nothing I've added.
That said, if I change the call to this, dpm($variables['classes']); I get this output:
... (Array, 0 elements)
$...
Krumo version 0.2.1a | http://krumo.sourceforge.net Called from /home/quantate/staging/sites/all/themes/genesis/genesis/template.php, line 152
... (Array, 1 element)
0 (Array, 1 element)
Krumo version 0.2.1a | http://krumo.sourceforge.net Called from /home/quantate/staging/sites/all/themes/genesis/genesis/template.php, line 152
 

« first day (3 days earlier)      last day (16 days later) »