Keyword

How to access/move around the Database from the subtemplate?

  • Giorgio
  • Giorgio's Avatar Topic Author
  • Offline
  • New Member
More
14 years 1 week ago #82602 by Giorgio
HiI've checked the mod_k2 and the com_k2 templates and see in general how their layout code works...I mean, changing the layout would mean to change the HTML/PHP etc.Is obvious finding the code lines where a field is echoed to the browser and such.Up to here, so far, all fine.But, if in a module, which its default template has a buckle for the amount of items specified on the backend(say 6 items)..., I wanted to show the 1rst item with certain format, then the next 2 with other format, the rest with other format, and even different fields shown and such.I suppose basically I'm gonna need to get rid of the buckle and "hard code" each record/item for displaying right?So, how am I going to tell the DataBase to move to the next record, or start again, etc.?, well, actually I suspect there's no need to access the DB but more of accessing the variables / DB datasets already available.This way I will be able to layout any items any way I want right?thank you very muchP.S. I already tried to display an item by copying some item code BEFORE the foreach buckle but it didn't showed the first item of the dataset, just the hard coded HTML info, and then followed the normal output of the buckled items.I suspect I needed something from that condition line on the beginning of the foreach buckle:<?php foreach ($items as $key=>$item?): ?>Not sure what this line is exactly doing but I guess I will need to do something similar in order to access the Data.

Please Log in or Create an account to join the conversation.

More
14 years 1 week ago #82603 by william white
Before trying to do it the hard way can you...
create a new k2 menu item and set the leading to 10 or so
select two categories to display (each with a different template and xtra fields selected)
When you drill into the article they will be formatted per the category template - or item if specified.
Try using the category layouts paramaters to change the way different items appear in the blog listing before displaying the article with its specific template.

Please Log in or Create an account to join the conversation.

  • Giorgio
  • Giorgio's Avatar Topic Author
  • Offline
  • New Member
More
14 years 1 week ago #82604 by Giorgio
thank you for your response

I'm all about doing it the easy way, is just that that was my logic to what I so far understand how k2 works, I mean, Joomla is already something new for me as it doesn't use pages but more of article layouts and such all assembled on the fly with the same index.php and its positions.
(I've been doing websites since 1997)

So...
I'm trying to understand what you're saying.
For NewsPaper Frontpages with more than 60items I thought Modules were the ones to be used for the 90% or 100% of the FrontPage content..., and the component just for the Category listing page and Item page, but again, I don't know yet, I'm exploring.

Let say on my FrontPage I have 1 main column with 4 main Areas say... Main, Sports, National and International.
* Each area has 1lead article, 2 primaries, and 10secondaries. Of course each article group has a different design format and/or fields showing.

* Maybe each area will have the same layout format with mild variations(color, background, etc.)

* Main area shows articles of what ever category, I mean, admins "decide" what Items to show there(by date?, manually specified? I don't know yet which criteria is more easy).

* And the other 3: Sports, National, International, each show articles from their specific category.

I thought for each Area I was going to use a module with say 13 articles each, then I was going to format the items design, and for that I see myself going moving trough the items as I'm sending output to the browser.

so..., this is done easier with the component instead of modules?





I understand at component level there are templates, are these phps category, category_item, category_items_links, item, the ones I need to create from there the templates I'll need?

I understand this takes time to explain, you all are very busy, this is a free community forum, that's why I'm considering to hire a consulting service but I don't know.. A) Where(are these ok? www.ostraining.com/) B) not even sure if, even after knowing how to do it, once knowing what it takes(time) because of its nature may not be viable for us, but this risk is insignificant anyway.


thank you

William White said:Before trying to do it the hard way can you... create a new k2 menu item and set the leading to 10 or so
select two categories to display (each with a different template and xtra fields selected)
When you drill into the article they will be formatted per the category template - or item if specified.
Try using the category layouts paramaters to change the way different items appear in the blog listing before displaying the article with its specific template.

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum