If I want to set a field as a css value.

More
16 years 1 month ago #3419 by despair
I try to make a templete,and I want to set a select field as a css style selector.

In the templete I want to make field in some tags.
like
<ul class="field1value field2value field3value">

I write
<ul class="iteminfo <?php foreach ($items[$i]->positions as $field) : ?> <?php echo $field->display; ?><?php endforeach; ?>">
But it error. :oops:


Sorry my english is poor. :oops:
Thanks for everyone!

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

More
16 years 1 month ago #3435 by Linuus
What error message do you get?

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

More
16 years 1 month ago #3436 by despair
<br />

<b>Warning</b>: Invalid argument supplied for foreach() in <b>..\www\TIWC\components\com_flexicontent\templates\profile\category_items.php</b> on line <b>236</b><br />

The line236 just what I add in the templete. :?:

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

More
16 years 1 month ago #3437 by Linuus
Have you created a position called color and put your fields here? I'm not that good with FC templates, but I guess you have to do that to use positions.

Do that and try the code below
Code:
<ul class="iteminfo <?php foreach ($this->items->positions['color'] as $field) : ?> <?php echo $field->display; ?><?php endforeach; ?>">


EDIT: Is it an item view or category view you're working with?

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

More
16 years 1 month ago - 16 years 1 month ago #3440 by despair
yes, I add a position in category.xml
<fieldgroups>
<group>images</group>
<group>otherinfo</group>
<group>color</group>
</fieldgroups>
than add a field also named color in the color position.

I really happy to find out Flexicontent is so powerfull.
I want to design a a category templete as school table.
But I'm not good in PHP.
So I want to set fields as css class with jQuery to control every category items.

I tried to build my first template last day. :oops:
140.122.88.193/TIWC/index.php?op ... e&Itemid=4

Many Thanks!!
Last edit: 16 years 1 month ago by despair.

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

More
16 years 1 month ago #3441 by Linuus
Ok, so the template you want to create is a category template, where all the items are listed and when you click the item title you see the detailed view of the template. Correct?
And every item should have its own row color?

I guess you have duplicated the default template or something?

Do I understand correctly? :)

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

More
16 years 1 month ago #3445 by despair
i will make a new template, rather than duplicate a default one.

In this case I created a new template named 'profile'.
I copied the blogs' category template and default item templete, then modifiied theme to build a gallery.

I just make a test to add an item in some tag like <ul class="item">,whose position is called "color ".

But finally I want to make other category template named course.

All category items' style can selected from fields selector.
When I creat a new course item ,If i select 'mon' and class1 the tag will like <li class="mon class1">
"mon" will set the category item's positon in the monday row, 'class1' will set the item positon 'top:0px';.

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

More
16 years 1 month ago #3449 by Linuus
hmmm ok.

And the code I added above doesn't do it?

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

More
16 years 1 month ago #3452 by despair
Thanks !
I added it
but it still the same.T_T

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

More
16 years 1 month ago #3455 by Linuus
Hmm.

Do you want each row in the list to have a color?
Then you have to put the code in the <li> tag and not the <ul> tag for starters.

But that doesn't solve the error though.

Can you please copy/paste some more code? Like from a couple of rows before the for loop and a couple of rows after.

EDIT:
Add this before your block as well:
<?php if (isset($this->item->positions)) : ?>

and this after:
<?php endif; ?>

Because if it's empty it might mess the foreach I guess.

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

Moderators: vistamediajoomlacornerggppdk
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline
Save