|
Spiral Scripts Support Forum :: Featured Items Modules |
|
|
|
|
|
Subject :Featured Carousel: Special CSS rules for the last item..
20-10-2010 16:21:20
|
|
|
mvcreative |
|
Fresher |
|
Joined: 08-10-2010 21:50:44
Posts: 7
Location: |
|
|
|
Hello everyone,
The requirement is to show border lines at the side of each featured Item.
I did a left border css rule, but as you can imagine, the last item doesn't show the border.
If I add a left and right rborder, the inner lines will look wider than the first and last one.
I can't find if the module detects the last item, so I can create a special rule for that one.
Any idea? Suggestion?
Thanks again |
IP Logged
|
|
|
|
|
|
|
Subject :Re:Featured Carousel: Special CSS rules for the last item..
22-10-2010 10:56:42
|
|
|
boggler |
|
Spiral Scripts Support |
|
Joined: 18-08-2009 10:14:13
Posts: 181
Location: |
|
|
|
The module does not detect the last item. You would need to add some php code to the template file to do that.
The template does include a $panecounter variable which counts the items. It is probably slightly easier if you have a special rule for the first item.
You can then enclose the panels in some extra div tags, so that lines 14 and 15 would become
<?php foreach ($list as $item) : ?>
<div class="<?php if($panecounter==0){ echo 'firstpane';} else{ echo 'pane';}">
You would need to close the div tags before the end of the loop, so that lines 30 and 31 would become
</div>
<?php endforeach; ?>
Then apply the css rules to the 'firstpane' and 'pane' classes. |
IP Logged
|
susan subway boggler |
|
|
|
|
|
|
Subject :Re:Featured Carousel: Special CSS rules for the last item..
22-10-2010 11:42:32
|
|
|
boggler |
|
Spiral Scripts Support |
|
Joined: 18-08-2009 10:14:13
Posts: 181
Location: |
|
|
|
Actually I have been thinking about this some more. My suggest may work, and is worth trying, but it is possible that it will interfere with the workings of the scrolling script.
Let me know either way. If the suggestion doesn't work then I will consider adding this feature in a future release, although that may not be for a couple of months. In principle it is quite simple to add but is complicated by the fact that it must avoid affecting the working of the carousel. |
IP Logged
|
susan subway boggler |
|
|
|
|
|
|
Subject :Re:Featured Carousel: Special CSS rules for the last item..
22-10-2010 17:19:16
|
|
|
mvcreative |
|
Fresher |
|
Joined: 08-10-2010 21:50:44
Posts: 7
Location: |
|
|
|
Thanks for the idea. I will try that out while keeping a backup of the files.
I will let you know. |
IP Logged
|
|
|
|
|
|
|
Subject :Re:Featured Carousel: Special CSS rules for the last item..
22-10-2010 19:54:02
|
|
|
mvcreative |
|
Fresher |
|
Joined: 08-10-2010 21:50:44
Posts: 7
Location: |
|
|
|
Ok... this is what happened so far:
- When creating the extra DIV, it changed the way the carousel works and the items didn't show in the right way.
Taking your idea to another file, i'm wokring on: scrollpane.php
In the function startPanel, i'm doing this:
function startPanel( $text, $id ){
$last = $id[strlen($id)-1];
if ($last == "4") {
return '<div style="border-right-width: 1px;border-right-style: solid;border-right-color: #FFF;" id="'.$id.'" class="scrollpanel">'.$text;
}
else {
return '<div style="border-left-width: 1px;border-left-style: solid;border-left-color: #FFF;" id="'.$id.'" class="scrollpanel">'.$text;
}
}
Basically I'm hardcoding the total number of Items to cound, and if it's the last one (I'm using 5 items now) it displays the DIV with the border on the right.
It's working, just need to adjust sizes to be able to show left and right borders on the last item.
Question:
From within the scrollpane.php,how can I ask the total number of items to display without recurring into conflicts with the other files that use this scrollpane.php.? I just need to check the number of total items.
Does this makes sense?
What do you think? |
IP Logged
|
|
|
|
|
|
|
Subject :Re:Featured Carousel: Special CSS rules for the last item..
23-10-2010 14:13:38
|
|
|
boggler |
|
Spiral Scripts Support |
|
Joined: 18-08-2009 10:14:13
Posts: 181
Location: |
|
|
|
I think you would do much better not to hard-code this.
Probably the best way to tackle this is to send an extra parameter to the startpanel method, which can be an optional additional css class for the pane:-
function startPanel( $text, $id, $css = 'pane' )
{
return '<div id="'.$id.'" class="scrollpanel'. ' '.$css.'">'.$text;
}
Then you define the css class in the template default.php file. I still think that you will make life a lot easier for yourself if you have different styling for the first item rather than the last, as it is easy to test for.
For example you can use
<?php foreach ($list as $item) :
if($panecounter == 0){
$css = 'firstpane';
}
else
{
$css = 'pane';
}
Then you can pass this as a third parameter to the startpanel method.
If you really have to have the different styling for the past panel you can use
if($panecounter == (count($list)-1)){
$css = 'lastpane';
}
else
{
$css = 'pane';
} |
IP Logged
|
Last Edited On: 23-10-2010 14:14:24 By boggler for the Reason |
susan subway boggler |
|
|
|
|
|
|
Subject :Re:Featured Carousel: Special CSS rules for the last item..
27-10-2010 22:00:22
|
|
|
mvcreative |
|
Fresher |
|
Joined: 08-10-2010 21:50:44
Posts: 7
Location: |
|
|
|
Thanks for the detailed option. I will take a look and see if I can make it work.
Just as a plan B, it is possible to ask for the total number of items to display from that file? (Scrollpane). I have that working and just to have that as an option in case I can't make your idea work.
Thanks again |
IP Logged
|
|
|
|
|
|
|
Subject :Re:Featured Carousel: Special CSS rules for the last item..
28-10-2010 09:31:22
|
|
|
boggler |
|
Spiral Scripts Support |
|
Joined: 18-08-2009 10:14:13
Posts: 181
Location: |
|
|
|
It is not possible to access the information the information about the number of items in scrollpane.php. You would need to pass that information as an additional parameter in the call to $layout->pane->startPanel in the default.php template file. |
IP Logged
|
susan subway boggler |
|
|
|
|