kunzite (kunzite1) wrote in component_help,
kunzite
kunzite1
component_help

Music/Book/TV components (v 4.0)

this is a version of my post here that implements heartflections' request here.
this has not been tested.

if you plan on making several of these components, you will want to append a number to the end of each italicized variable.
###################################
#     MUSIC\BOOK\TV COMPONENT     #
# kunzite1, component-help/756360 #
# add to print_free_text(Page p)  #
###################################
var string k1Mheader = "Music";   # title of component
var string k1Mheight = "175px";   # height of component
var Color  k1Mborder = "#000000"; # bordercolor for images
var Color  k1MbgOne  = "#ffffff"; # background color one for text
var Color  k1MbgTwo  = "#000000"; # background color two for text
var Color  k1MfgOne  = "#000000"; # foreground color one for text
var Color  k1MfgTwo  = "#ffffff"; # foreground color two for text

# use color scheme as used in v 2.0
$k1MbgOne = $*comp_bgcolor;
$k1MbgTwo = $*main_bgcolor;

var Color    k1Mbg;
var Color    k1Mfg;
var string[] k1Msrc;
var string[] k1Malt;
var string[] k1Mtitle;
var string[] k1Murl;
var int      k1Mindex = 0;

# set one
$k1Msrc[$k1Mindex]   = "src 1";
$k1Malt[$k1Mindex]   = "alt 1";
$k1Mtitle[$k1Mindex] = "title 1";
$k1Murl[$k1Mindex]   = "optional linking url 1";
$k1Mindex++;

# set two
$k1Msrc[$k1Mindex]   = "src 2";
$k1Malt[$k1Mindex]   = "alt 2";
$k1Mtitle[$k1Mindex] = "title 2";
$k1Murl[$k1Mindex]   = "optional linking url 2";
$k1Mindex++;

# copy sets as necessary

# comment this section if this is in the non-print_free_text section of the page_layout function when using the components on both sides tutorial
print_comp_header($k1Mheader);

# decomment this section if this is in the non-print_free_text section of the page_layout function when using the components on both sides tutorial
# print $comp_header_open; print $k1Mheader; print $comp_header_close;
"""
<div id="Layer1" style="position:relative; width:100%; height:$k1Mheight; z-index:1; overflow: auto; overflow-x: hidden;">
<table width="100%" cellpadding="3" cellspacing="0">
""";

foreach var int k1Mi (0 .. (size($k1Msrc) - 1)){
  $k1Mbg = ($k1Mi % 2 == 0) ? $k1MbgOne : $k1MbgTwo;
  $k1Mfg = ($k1Mi % 2 == 0) ? $k1MfgOne : $k1MfgTwo;
  """
  <tr style="background-color:$k1Mbg; color:$k1Mfg;">
  <td style="text-align:left;">""";
if($k1Murl[$k1Mi] != "") { """<a href="$k1Murl[$k1Mi]">"""; }
  """<img src="$k1Msrc[$k1Mi]" border="0" style="border: 1px solid $k1Mborder" alt="$k1Malt[$k1Mi]" title="$k1Malt[$k1Mi]" />""";
if($k1Murl[$k1Mi] != "") { """</a>"""; }
  """</td>
  <td style="font-weight:bold; text-align:left;">$k1Mtitle[$k1Mi]</td>
  </tr>
  """;
}

"""
</table>
</div>
""";
# comment this section if this is in the non-print_free_text section of the page_layout function when using the components on both sides tutorial
print_comp_footer();

# decomment this section if this is in the non-print_free_text section of the page_layout function when using the components on both sides tutorial
# print $comp_footer;
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

  • 0 comments