php - PyroCMS Tags in Arrays -


i using codeigniter pyrocms in work website developer. colleagues have used pyro longer have using pyro tags lot. seem extremely useful, if don't have clue how work yet. anyway, trying use tags in php array, pyro doesn't seem that.

the code in question:

{{ eods }}     <tr>         <td value="{{ user_id }}" class = "span1">{{ user_id }}</td>         <td value="{{ eod }}" class = "span2">{{ eod }}</td>         <td value="{{ mit_id }}" class = "span2"><?php echo $this->db->get_where('mit', array('id' => {{ mit_id }})); ?></td>         <td value="{{ date }}" class = "span2">{{ date }}</td>         <td value="{{ time }}" class = "span2">{{ time }}</td>     </tr> {{ /eods }} 

i error:

parse error: syntax error, unexpected '{' in c:\repos\mit-eod\addons\shared_addons\modules\mit\views\history.php on line 48

the error on line php code (line 5), in php echo statement. can confirm it's third opening curly brace on line, first 1 in {{ mit_id }}.

why happening?

you can't use tags in php code, php code interpreted php code first, not part of template. should logic in controller or model , pass whatever you're getting db in $eods variable template.

also,

<?php echo $this->db->get_where('mit', array('id' => $thing)); ?> 

will mysql (probably) result, not single value. @ least need like:

$var = $this->db->get_where('mit', array('id' => $thing))->row()->thing; 

but throw error if no rows found. mysql join might better.

good luck.


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -