Syntax error

  • Dan030981
  • Novice
  • Novice
  • User avatar
  • Posts: 23
  • Loc: Mass

Post 3+ Months Ago

I'm having some trouble trying to solve this syntax error. Can anyone help me please?

Quote:
<?php
$context = get_context();

// Dashboard widgets.
if($context == 'dashboard','profile') {
$widgets = array(
'meetups_small',
'albums',
'videos',

);
foreach($widgets as $widget) {
echo elgg_view('theme_widgets/' . $widget);
}
}
?>
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Dan030981
  • Novice
  • Novice
  • User avatar
  • Posts: 23
  • Loc: Mass

Post 3+ Months Ago

figured it all out :)
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9090
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

I am guessing it was this line:

Code: [ Select ]
if($context == 'dashboard','profile') {


Is that the part you figured out? :)
  • Dan030981
  • Novice
  • Novice
  • User avatar
  • Posts: 23
  • Loc: Mass

Post 3+ Months Ago

yes, I turned it into an array

Code: [ Select ]
if($context == array('dashboard','profile'));


I hope that I did it right. If not, any suggestions?
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9090
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

I guess that would depend on what $context is holding. Your syntax is good, it just depends on what your logic is here as that could still be wrong and wouldn't return any PHP errors. What does the function get_context() return? With this code:

Code: [ Select ]
if($context == array('dashboard','profile'));


That will return true if $context has the same array values as you are testing there. You can see the array operators here:

http://php.net/manual/en/language.operators.array.php

Post Information

  • Total Posts in this topic: 5 posts
  • Users browsing this forum: demonmaestro and 83 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.