Welcome Guest, Not a member yet? Register   Sign In
Template Parser question
#1

[eluser]NateL[/eluser]
Is it possible to pull something specific out of the database, based on a given ID?

For instance, in the user guide example, you can do

Code:
{blog_entries}
<h5>{title}</h5>
<p>{body}</p>
{/blog_entries}

Can you do something like this?
Code:
{blog_entries=5}
<h5>{title}</h5>
<p>{body}</p>
{/blog_entries}

where "5" is the category ID.

Thanks Smile
#2

[eluser]InsiteFX[/eluser]
Pass your view the $data array and then use a php echo to show your category count.

Enjoy
InsiteFX
#3

[eluser]NateL[/eluser]
ooooohhhhhhh I see - In my controller, get all blog entries with the category id of 5, (use a model to retrieve those results), and then pass those results into my view.

I think I got it Smile

Thanks
#4

[eluser]Aken[/eluser]
Yeah, you shouldn't be pulling / passing any more information that you'll need.
#5

[eluser]suprb[/eluser]
Can someone, maybe you NateL please post a code snippet (model, controller, view if possible) of how you did this?

I'm interested to know how you can send the "5" in {blog_entries=5} to a controller / model to pull something out of a database.

Would help me a lot.

TIA!




Theme © iAndrew 2016 - Forum software by © MyBB