Welcome Guest, Not a member yet? Register   Sign In
Append variable to column name during select statement
#5

[eluser]mvdg27[/eluser]
Basically I'm using it to feed the template class. I've created some easy to use functions for my web developers to retract data from the system, such as menu, a block or current page info etc. And just to prevent variables from being overwritten, because they have the same name, I've introduced this variable to make the variable names unique. An example:

For the current page I have various info available, such as 'title', 'url' etc. Now if I would want to loop through the menu with the Template class, like this:

Code:
<ul>
{menu}
  <li><a href="{url}">{title}</a><li>
{/menu}
</ul>

That wouldn't work as expected. In this situation it will reuse the url and title of the page, instead of using the values from the loop. So I've decided, that in the function that retrieves the menu in the template, you can pass a variable name, which serves as a suffix for these values and use it as such:

Code:
<ul>
{menu}
  <li><a href="{menu_url}">{menu_title}</a><li>
{/menu}
</ul>

That's in short the context that I'm in ..


Messages In This Thread
Append variable to column name during select statement - by El Forum - 04-19-2009, 09:32 AM
Append variable to column name during select statement - by El Forum - 04-19-2009, 09:40 AM
Append variable to column name during select statement - by El Forum - 04-19-2009, 10:32 AM
Append variable to column name during select statement - by El Forum - 04-19-2009, 12:36 PM
Append variable to column name during select statement - by El Forum - 04-19-2009, 01:57 PM
Append variable to column name during select statement - by El Forum - 04-19-2009, 02:06 PM
Append variable to column name during select statement - by El Forum - 04-19-2009, 02:11 PM
Append variable to column name during select statement - by El Forum - 04-20-2009, 09:13 AM



Theme © iAndrew 2016 - Forum software by © MyBB