CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> Tips & Solutions

 Alternate Rows (onmouse-over) [PHP]

Print topic Send  topic

Author Message
feha


Posts: 712
Posted: 02/07/2006, 6:53 AM

Based on:
http://forums.yessoftware.com/posts.php?post_id=68752
Louis and Benjamin (Me too :-) )

the function:
  
function VISION_TO_ALTERNATE ()  
{  
// www.vision.to   
		global $Tpl;  
		$highlight = "";  
		global $isAltRow;  
		$RowClass = "Row";  
		if($isAltRow)   
		{  
		$RowClass = "AltRow";  
		}  
		$isAltRow = (!$isAltRow);  
		$Tpl->SetVar("RowClass",$RowClass);  
		if(defined("USE_GRID_MOUSEOVER") && USE_GRID_MOUSEOVER==1)  
		{  
		if($RowClass == "Row")  
		{  
		$highlight = "onmouseover='this.className=\"RowHL\"' onmouseout='this.className=\"Row\"'";   
		}  
		else  
		{  
		$highlight = "onmouseover='this.className=\"RowHL\"' onmouseout='this.className=\"AltRow\"'";  
		}  
		}  
		$Tpl->SetVar("highlight",$highlight);  
}  

How to use it ? [Before show Row event]
  
//Custom Code @208-2A29BDB7  
// -------------------------  
    // Write your own code here.  
VISION_TO_ALTERNATE ();  
// -------------------------  
//End Custom Code  

HTML editing:
  
                   <!-- BEGIN Row -->  
                      <tr class="Row {RowClass}" {highlight}>  
                        <td><a href="{role_Src}">{role}</a> </td>   
                        <td style="TEXT-ALIGN: center">{active} </td>   
                        <td style="TEXT-ALIGN: right">{display_order} </td>  
                      </tr>  
 <!-- END Row -->  
Note there are two classes (or more allowed by css).
<tr class="Row {RowClass}" {highlight}>  
but can be used as:
<tr class="{RowClass}" {highlight}>  
Note: there is THIRD style added for onmouse over
  
.RowHL td {   
	  
	padding: 2px;  
	border-top: 1px solid #7c7c7c; border-right: 1px solid #7c7c7c;  
	vertical-align: top;  
	background-color: #FFFFC5;   
	color: #0000ff;  
	}  
  
.RowHL a:link {   
	color:  #000000;  
	}  
  
.RowHL a:visited {   
	color:  #000000;  
	}  
  
.RowHL a:hover, .RowH a:active {   
	color: #000000;  
	}  

enjoy :-)

_________________
Regards
feha

www.vision.to
feedpixel.com
View profile  Send private message
Benjamin Krajmalnik
Posted: 02/08/2006, 1:59 PM

Feha,

The best solution would be to create this as a class.
You would instantiate the class for each grid.
The "isaltrow" variable would no longer be global.

This will keep the alternating rows uniform on all different grids. The
current implementatio, with one isaltrow global variable, can potentially
have some grids starting in the wrong color if you have multiple grids in
one page.

feha


Posts: 712
Posted: 02/10/2006, 1:11 AM

Hi Benjamin
Thank you it is good idea creating it as class.
Will try later if i get more time.

Now is easy to make changes in one place instead of editing all HTML templates. :-)

_________________
Regards
feha

www.vision.to
feedpixel.com
View profile  Send private message
Abs
Posted: 02/15/2006, 1:20 AM

Any examples of this in ASP.net VB?


Thanks
feha


Posts: 712
Posted: 02/17/2006, 6:52 AM

I'm sorry i don't program in ASP.
_________________
Regards
feha

www.vision.to
feedpixel.com
View profile  Send private message
feha


Posts: 712
Posted: 03/24/2006, 12:15 PM

The function has been updated allowing proper alternate with more than one grid on the same page ... :-)

  
function VISION_TO_ALTERNATE ($Tpl="",$isAltRow="")  
{  
// By www.vision.to   
		global $Tpl;  
		$highlight = "";  
		global $isAltRow;  
		$RowClass = "Row";  
		if($isAltRow)   
		{  
		$RowClass = "AltRow";  
		}  
		$isAltRow = (!$isAltRow);  
		$Tpl->SetVar("RowClass",$RowClass);  
		if(defined("USE_GRID_MOUSEOVER") && USE_GRID_MOUSEOVER==1)  
		{  
		if($RowClass == "Row")  
		{  
		$highlight = "onmouseover='this.className=\"RowHL\"' onmouseout='this.className=\"Row\"'";   
		}  
		else  
		{  
		$highlight = "onmouseover='this.className=\"RowHL\"' onmouseout='this.className=\"AltRow\"'";  
		}  
		}  
		$Tpl->SetVar("highlight",$highlight);  
}  

_________________
Regards
feha

www.vision.to
feedpixel.com
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.