kunzite (kunzite1) wrote in component_help,
kunzite
kunzite1
component_help

Music/Book/TV components (v 2.0)

this is a version of sashwizzled's post here that is easier on the s2 engine.

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/260686 #
# 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    k1Mbg;
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) ? $*main_bgcolor : $*comp_bgcolor;
  """
  <tr style="background-color:$k1Mbg;">
  <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;
Tags: admin: deprecated, user: kunzite1
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

  • 178 comments
Previous
← Ctrl ← Alt
Next
Ctrl → Alt →
Previous
← Ctrl ← Alt
Next
Ctrl → Alt →