Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder
    Join Date
    Oct 2009
    Location
    GERMANY
    Posts
    140
    Thanks
    29
    Thanked 1 Time in 1 Post

    need help with this

    I want to modify this table by adding a class to it and then at specific details for that table in my style.css file, however it shows an parse error and I'm not sure what to do.

    Here's the ORIGINAL code:

    PHP Code:
    <tr>
            <td>&nbsp;</td>
            <td>
            <a href="<?php echo $subcat_url?>"><?php echo $rowsubcat['subcatname']; ?></a>
            <?php if($show_subcat_adcount) { ?><span class="count">(<?php echo $adcount?>)</span><?php ?>
            <br>
            </td>
            </tr>
    I added this to the first line:

    class="subcats"

    I then added "subcats" in the style.css file like this

    PHP Code:
    subcats {
        
    background-colorsteelblue;    

    And now it shows a parse error. I'm not sure what to do. Any help is highly appreciated!

  • #2
    Regular Coder
    Join Date
    Oct 2009
    Location
    GERMANY
    Posts
    140
    Thanks
    29
    Thanked 1 Time in 1 Post
    Upon further reading, I think I found the problem. What I am trying to do is modify subcategories but I think they are "bonded" to the categories. Bonded as in the same table, not a separate one. Here's the file:

    PHP Code:
    <table border="0" cellspacing="0" cellpadding="3" width="98%" class="dir"><tr>

    <?php

    // Create main directory

    if($dir_sort
    {
        
    $sortcatsql "ORDER BY catname";
        
    $sortsubcatsql "ORDER BY subcatname";
    }
    else
    {
        
    $sortcatsql "ORDER BY pos";
        
    $sortsubcatsql "ORDER BY scat.pos";
    }



    // First get ads per cat and subcat
    $subcatadcounts = array();
    $catadcounts = array();
    $sql "SELECT scat.subcatid, scat.catid, COUNT(*) as adcnt
            FROM $t_ads a
                INNER JOIN $t_subcats scat ON scat.subcatid = a.subcatid AND ($visibility_condn)
                INNER JOIN $t_cats cat ON cat.catid = scat.catid
                INNER JOIN $t_cities ct ON a.cityid = ct.cityid
            WHERE scat.enabled = '1'
                $loc_condn
            GROUP BY a.subcatid"
    ;

    $res mysql_query($sql) or die(mysql_error().$sql);

    while(
    $row=mysql_fetch_array($res))
    {
        
    $subcatadcounts[$row['subcatid']] = $row['adcnt'];
        
    $catadcounts[$row['catid']] += $row['adcnt'];
    }



    // Categories
    $sql "SELECT catid, catname AS catname FROM $t_cats WHERE enabled = '1' $sortcatsql";
    $rescats mysql_query($sql) or die(mysql_error());
    $catcount = @mysql_num_rows($rescats);

    $percol_short floor($catcount/$dir_cols);
    $percol_long $percol_short+1;
    $longcols $catcount%$dir_cols;

    $i 0;
    $j 0;
    $col 0;
    $thiscolcats 0;

    while(
    $rowcat=mysql_fetch_array($rescats))
    {
        if (
    $j >= $thiscolcats)
        {
            
    $col++;
            
    $thiscolcats = ($col $longcols) ? $percol_short $percol_long;
            
    $j 0;
            
            echo 
    "<td valign=\"top\" width=\"$cell_width%\">";
        }

        
    $i++;
        
    $j++;

        
    $catname_inurl RemoveBadURLChars($rowcat['catname']);
        if(
    $sef_urls$catlink "{$vbasedir}$xcityid/posts/$rowcat[catid]_{$catname_inurl}/0/";
        else 
    $catlink "?view=ads&catid=$rowcat[catid]&cityid=$xcityid&lang=$xlang";

        
    $adcount 0+$catadcounts[$rowcat['catid']];

    ?>

        <table border="0" cellspacing="0" cellpadding="0" width="100%" class="dir_cat">
        <tr>
        <th width="25" valign="top"><img src="images/category.gif" border="0" align="absmiddle"></th>
        <th><a href="<?php echo $catlink?>"><?php echo $rowcat['catname']; ?></a>
        <?php if($show_cat_adcount) { ?><span class="count">(<?php echo $adcount?>)</span><?php ?>
        </th>
        </tr>

    <?php

        $sql 
    "SELECT scat.subcatid, scat.subcatname AS subcatname
        FROM $t_subcats scat
        WHERE scat.catid = $rowcat[catid]
            AND scat.enabled = '1'
        $sortsubcatsql"
    ;

        
    $ressubcats mysql_query($sql) or die(mysql_error()."<br>$sql");

        while (
    $rowsubcat mysql_fetch_array($ressubcats))
        {
            
    $adcount 0+$subcatadcounts[$rowsubcat['subcatid']];

            if(
    $sef_urls$subcat_url "{$vbasedir}$xcityid/posts/$rowcat[catid]_{$catname_inurl}/$rowsubcat[subcatid]_"RemoveBadURLChars($rowsubcat['subcatname'])."/";
            else 
    $subcat_url "?view=ads&catid=$rowcat[catid]&subcatid=$rowsubcat[subcatid]&cityid=$xcityid&lang=$xlang";

    ?>
            <tr>
            <td>&nbsp;</td>
            <td>
            <a href="<?php echo $subcat_url?>"><?php echo $rowsubcat['subcatname']; ?></a>
            <?php if($show_subcat_adcount) { ?><span class="count">(<?php echo $adcount?>)</span><?php ?>
            <br>
            </td>
            </tr>

    <?php

        
    }

    ?>
        
        </table>
        <br>

    <?php

        
    if($j==$thiscolcats || $i==$catcount) echo "</td>";

    }


    ?>

    </tr></table>
    Could that be the reason why it didn't work when I added the class?

  • #3
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts
    show us the html as per source view, instead of with php through it. the php is largely irrelevant to the html presentation and because I don't use php it is harder to give help if php is in the code.

    bazz
    "The day you stop learning is the day you become obsolete"! - my late Dad.

    Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
    Useful MySQL resource
    Useful MySQL link

  • #4
    Regular Coder
    Join Date
    Oct 2009
    Location
    GERMANY
    Posts
    140
    Thanks
    29
    Thanked 1 Time in 1 Post
    Quote Originally Posted by bazz View Post
    show us the html as per source view, instead of with php through it. the php is largely irrelevant to the html presentation and because I don't use php it is harder to give help if php is in the code.

    bazz
    here you go:

    Code:
     
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
    <html> 
    <head> 
    <title>Bayern - PHUGN.de - Heute schon gephugt?</title> 
    <base href="http://testobject.cwsurf.de/"> 
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
    <meta name="keywords" content="classifieds,posts,ads,events,images,buy,sell,trade,real estate,apartments,personals,dating,xzero community classifieds,xzero classifieds,community classifieds,community,society,social networking"> 
    <meta name="description" content="Classifieds for our community. Buy, sell, trade, date, events... post anything. XZero Community Classifieds."> 
    <link rel="stylesheet" type="text/css" href="style.css"> 
    <link rel="stylesheet" type="text/css" href="pager.css"> 
    <link rel="stylesheet" type="text/css" href="cal.css"> 
    </head> 
     
    <body> 
     
     
     
    <table width="100%" border="0" cellspacing="0" cellpadding="0" align="left"> 
     
    	<tr><td colspan="3"><table width="100%"  border="0" cellspacing="0" cellpadding="0" id="header"> 
     
    <tr><td> 
     
    <div id="logo"> 
    <a href="-1_Bayern/"> 
    <img src="images/logo.gif" border="0"><br> 
    </a></div> 
    </td> 
     
    <td align="right" valign="bottom"> 
     
      <div id="logo"><a href="-1_Bayern/">Bayern</a> </div> 
      <div id="today"> Dienstag, 03 November, 2009 </div> 
      <br> 
     
     
     
     
    </td> 
    </tr></table></td></tr>	
    	
    	<tr> 
     
     
    		
     
    		<td width="185" id="sidebar_left" valign="top"> 
     
    			<table width="90%" class="buttons" cellpadding="0" align="center"> 
     
    			<tr> 
    			<td> 
    			<a href="index.php?cityid=-1">Home</a> 
    			</td> 
    			</tr> 
     
    			<tr> 
    			<td> 
    			<a href="http://testobject.cwsurf.de/index.php?view=post&cityid=-1&lang=en">Anzeige Eintragen</a> 
    			</td> 
    			</tr> 
     
     
    						
    						
     
    						<tr> 
    			  <td><a href="www.test.com" target="_blank">Forum</a></td> 
    			  </tr> 
    			<tr> 
    			<td><a href="help.php">Hilfe / FAQ</a></td> 
    			</tr> 
    			
    		  </table> 
    			<div align="center"><br> 
    			  		  </div> 
    			<table width="90%" class="sidebox" cellspacing="0" align="center"> 
    				<tr><th class="head"> 
    				Suche				</tr></th> 
    				<tr><td> 
    				<form action="?" method="get"> 
    <input type="hidden" name="cityid" value="-1"> 
    <input type="hidden" name="lang" value="en"> 
    <input name="search" type="text" size="25" value=""> 
     
    	
    	<br><img src="images/spacer.gif" height="2" width="2"><br> 
    	<select name="catid"> 
    	<option value="1">Autos</option> 
    <option value="2">Motorrad</option> 
    <option value="3">Fahrrad</option> 
    <option value="4">Ketcar</option> 
    <option value="5">Scooter</option> 
    	<option value="-1">Events</option>	</select> 
    	<input type="hidden" name="view" value="ads"> 
     
     
     
    <button type="submit">Go</button> 
    </form>				</td></tr> 
    				<tr><td>&nbsp;</td></tr> 
    			</table> 
    			<div align="center"><strong>Event Kalender </strong><br> 
    			      
     
      
    			  
     
     
    			      
    				</div> 
    			    <table width="90%" cellspacing="0" class="sidebox" align="center"> 
    										
    					
    					<tr><td> 
    					<br> 
    							<table cellspacing="1" border="0" cellpadding="0" class="calendar"> 
    		<tr> 
    		<td class="cal_header_month"><a href="?cityid=&catid=&subcatid=&adid=&imgid=&countryid=&areaid=&pos=&picid=&page=&foptid=&eoptid=&pricemin=&pricemax=&_xzcal_m=10&_xzcal_y=2009">&laquo;</a></td> 
    		<td colspan="5" class="cal_header_month">November 2009</td> 
    		<td class="cal_header_month"><a href="?cityid=&catid=&subcatid=&adid=&imgid=&countryid=&areaid=&pos=&picid=&page=&foptid=&eoptid=&pricemin=&pricemax=&_xzcal_m=12&_xzcal_y=2009">&raquo;</a></td> 
    		</tr> 
    		<tr> 
    			<td class="cal_header_week" width="20">S</td> 
    			<td class="cal_header_week" width="20">M</td> 
    			<td class="cal_header_week" width="20">D</td> 
    			<td class="cal_header_week" width="20">M</td> 
    			<td class="cal_header_week" width="20">D</td> 
    			<td class="cal_header_week" width="20">F</td> 
    			<td class="cal_header_week" width="20">S</td> 
    		</tr><tr><td><a href="-1/events/2009-11-01/">1</a></td><td><a href="-1/events/2009-11-02/">2</a></td><td id="today"><a href="-1/events/2009-11-03/">3</a></td><td><a href="-1/events/2009-11-04/">4</a></td><td><a href="-1/events/2009-11-05/">5</a></td><td><a href="-1/events/2009-11-06/">6</a></td><td><a href="-1/events/2009-11-07/">7</a></td></tr><tr><td><a href="-1/events/2009-11-08/">8</a></td><td><a href="-1/events/2009-11-09/">9</a></td><td><a href="-1/events/2009-11-10/">10</a></td><td><a href="-1/events/2009-11-11/">11</a></td><td><a href="-1/events/2009-11-12/">12</a></td><td><a href="-1/events/2009-11-13/">13</a></td><td><a href="-1/events/2009-11-14/">14</a></td></tr><tr><td><a href="-1/events/2009-11-15/">15</a></td><td><a href="-1/events/2009-11-16/">16</a></td><td><a href="-1/events/2009-11-17/">17</a></td><td><a href="-1/events/2009-11-18/">18</a></td><td><a href="-1/events/2009-11-19/">19</a></td><td><a href="-1/events/2009-11-20/">20</a></td><td><a href="-1/events/2009-11-21/">21</a></td></tr><tr><td><a href="-1/events/2009-11-22/">22</a></td><td><a href="-1/events/2009-11-23/">23</a></td><td><a href="-1/events/2009-11-24/">24</a></td><td><a href="-1/events/2009-11-25/">25</a></td><td><a href="-1/events/2009-11-26/">26</a></td><td><a href="-1/events/2009-11-27/">27</a></td><td><a href="-1/events/2009-11-28/">28</a></td></tr><tr><td><a href="-1/events/2009-11-29/">29</a></td><td><a href="-1/events/2009-11-30/">30</a></td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>					<br> 
    					</td></tr> 
     
    					<tr><td align="center"> 
    										<div align="center"> 
    										
    					</div> 
    					</td></tr> 
     
    		  </table> 
    				<table width="90%" align="center" cellpadding="0" class="buttons"> 
     
    			<tr> 
    			  <td><a href="index.php?view=post&postevent=1&cityid=-1">Event Hinzufügen</a> </td> 
    			  </tr> 
    			<tr> 
    			  <td><a href="-1/events/">Zukünftige Events</a></td> 
    			  </tr> 
    			<tr> 
    			<td><a href="safety.php">Sicherheit</a></td> 
    			</tr> 
     
    			<tr> 
    			<td> 
    			<a href="terms.php">AGB</a></td> 
    			</tr> 
     
     
    						<tr> 
    			<td> 
    			<a href="privacy.php">Datenschutzrichtlinien</a> 
    			</td> 
    			</tr> 
    			
    						
     
    						<tr> 
    			<td> 
    			<a href="contact.php">Kontakt</a> 
    			</td> 
    			</tr> 
    			
    		  </table> 
    			    <p>    
    			          
    				</p> 
    				<table width="90%" cellspacing="0" class="sidebox" align="center"> 
    				<tr><th class="head">&nbsp;</th> 
    				</tr> 
     
    				<tr><td> 
     
    				<div align="center"> 
    				</div> 
    				</td></tr> 
    				</table> 
     
    						<br> 
     
     
    			<table width="90%" cellspacing="0" class="sidebox" align="center"><tr><td align="left"> 
    						</td></tr></table> 
    			<br> 
     
     
    		</td> 
     
     
    		
     
    		<td valign="top" id="contentcell"> 
                    <div style="display:none;"><!--#&88;#&90;#&101;#&114;#&111;#&83;#&99;#&114;#&105;#&112;#&116;#&115;#&46;#&99;#&111;#&109;--></div> 
            
    		<table width="100%" cellspacing="0" cellpadding="0"><tr> 
    		<td id="content"> 
     
    		
     
    <table border="0" cellspacing="0" cellpadding="3" width="98%" class="dir"><tr> 
     
    <td valign="top" width="33%"> 
    	<table border="0" cellspacing="0" cellpadding="0" width="100%" class="dir_cat"> 
    	<tr> 
    	<th width="25" valign="top"><img src="images/category.gif" border="0" align="absmiddle"></th> 
    	<th><a href="-1/posts/1_Autos/0/">Autos</a> 
    	<span class="count">(0)</span>	</th> 
    	</tr> 
     
    		<tr> 
    		<td>&nbsp;</td> 
    		<td> 
    		<a href="-1/posts/1_Autos/1_Kleinwagen/">Kleinwagen</a> 
    		<span class="count">(0)</span>		<br> 
    		</td> 
    		</tr> 
     
    		<tr> 
    		<td>&nbsp;</td> 
    		<td> 
    		<a href="-1/posts/1_Autos/2_LKW/">LKW</a> 
    		<span class="count">(0)</span>		<br> 
    		</td> 
    		</tr> 
     
    	
    	</table> 
    	<br> 
     
     
    	<table border="0" cellspacing="0" cellpadding="0" width="100%" class="dir_cat"> 
    	<tr> 
    	<th width="25" valign="top"><img src="images/category.gif" border="0" align="absmiddle"></th> 
    	<th><a href="-1/posts/2_Motorrad/0/">Motorrad</a> 
    	<span class="count">(2)</span>	</th> 
    	</tr> 
     
    		<tr> 
    		<td>&nbsp;</td> 
    		<td> 
    		<a href="-1/posts/2_Motorrad/3_Chopper/">Chopper</a> 
    		<span class="count">(1)</span>		<br> 
    		</td> 
    		</tr> 
     
    		<tr> 
    		<td>&nbsp;</td> 
    		<td> 
    		<a href="-1/posts/2_Motorrad/4_Racing/">Racing</a> 
    		<span class="count">(1)</span>		<br> 
    		</td> 
    		</tr> 
     
    	
    	</table> 
    	<br> 
     
    </td><td valign="top" width="33%"> 
    	<table border="0" cellspacing="0" cellpadding="0" width="100%" class="dir_cat"> 
    	<tr> 
    	<th width="25" valign="top"><img src="images/category.gif" border="0" align="absmiddle"></th> 
    	<th><a href="-1/posts/3_Fahrrad/0/">Fahrrad</a> 
    	<span class="count">(0)</span>	</th> 
    	</tr> 
     
    	
    	</table> 
    	<br> 
     
     
    	<table border="0" cellspacing="0" cellpadding="0" width="100%" class="dir_cat"> 
    	<tr> 
    	<th width="25" valign="top"><img src="images/category.gif" border="0" align="absmiddle"></th> 
    	<th><a href="-1/posts/4_Ketcar/0/">Ketcar</a> 
    	<span class="count">(0)</span>	</th> 
    	</tr> 
     
    	
    	</table> 
    	<br> 
     
    </td><td valign="top" width="33%"> 
    	<table border="0" cellspacing="0" cellpadding="0" width="100%" class="dir_cat"> 
    	<tr> 
    	<th width="25" valign="top"><img src="images/category.gif" border="0" align="absmiddle"></th> 
    	<th><a href="-1/posts/5_Scooter/0/">Scooter</a> 
    	<span class="count">(0)</span>	</th> 
    	</tr> 
     
    	
    	</table> 
    	<br> 
     
    </td> 
    </tr></table> 
    <br> 
     
     
     
     
     
    <table border="0" cellspacing="0" cellpadding="0"  class="adlisting" width="100%"> 
     
     
     
    </table> 
    </div> 
     
     
     
     
     
    <table border="0" cellspacing="0" cellpadding="0"  class="adlisting" width="100%"> 
     
     
     
    </table> 
    </div> 
     
     
     
     
    		</td> 
    		</tr></table> 
     
    		</td> 
     
     
    		
    			<td width="130" valign="top" id="sidebar_right_cities"> 
     
     
    			<table width="100%"><tr><td valign="top"> 
     
     
    	<div><a href="-1_Bayern/" class="citylist_country">Bayern </a></div> 
     
     
    	
    			<a href="1_Aschaffenburg/" class="citylist_city">Aschaffenburg </a><br> 
    			
    	
     
    	
     
    	<div><a href="-2_Hessen/" class="citylist_country">Hessen </a></div> 
     
     
    	
     
    	
    </td></tr></table> 
    			</td> 
     
    		
     
    	</tr> 
     
     
    <tr><td colspan="3"><table width="100%" id="footer"><tr><td> 
    Copyright &copy; 2009  PHUGN.de - Heute schon gephugt?. Alle Rechte Vorbehalten | 
    <a href="terms.php">AGB</a> | 
    <a href="privacy.php">Datenschutzrichtlinien</a><br> 
     
     
    <br><br> 
    </td></tr></table></td></tr> 
     
     
    </table> 
     
    </body> 
    </html>

  • #5
    Senior Coder tomws's Avatar
    Join Date
    Nov 2007
    Location
    Arkansas
    Posts
    2,644
    Thanks
    29
    Thanked 330 Times in 326 Posts
    Quote Originally Posted by OGGordon View Post
    I then added "subcats" in the style.css file like this

    PHP Code:
    subcats {
        
    background-colorsteelblue;    

    And now it shows a parse error. I'm not sure what to do. Any help is highly appreciated!
    Class names are preceded by a dot in the css file:
    Code:
    .subcats {
    	background-color: steelblue;	
    }
    And I think table row colors need to be applied to the cells in the row rather than the row itself. The HTML people here can confirm.

    If you get a PHP error, post it. It's impossible to guess error messages.
    Are you a Help Vampire?

  • Users who have thanked tomws for this post:

    OGGordon (11-03-2009)

  • #6
    Regular Coder
    Join Date
    Oct 2009
    Location
    GERMANY
    Posts
    140
    Thanks
    29
    Thanked 1 Time in 1 Post
    Quote Originally Posted by tomws View Post
    Class names are preceded by a dot in the css file:
    Code:
    .subcats {
    	background-color: steelblue;	
    }
    And I think table row colors need to be applied to the cells in the row rather than the row itself. The HTML people here can confirm.

    If you get a PHP error, post it. It's impossible to guess error messages.
    thanks you are the best! i added the dot and now it works fine. I added it in the <tr> tag.
    Last edited by OGGordon; 11-03-2009 at 01:30 AM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •