Forum Index
RegisterSearchFAQMemberlistUsergroupsLog in
TUT. kill tables, make valid xhtml

 
Reply to topic    Forum Index » Suggestions View previous topic
View next topic
TUT. kill tables, make valid xhtml
Author Message
Saszoo



Joined: 07 Jun 2006
Posts: 409
Location: Norway

Post TUT. kill tables, make valid xhtml Reply with quote
Okay, here it goes, I'll try to give some advice on how to kill the tables in the cutenews forms and how to style them, because as we all know, tables are used to display tabular data and not design... This will make valid xhtml-code..

any questions or suggestions are of course welcome Very Happy



Step 1.

Edit search.php

replace everything from line 29 to 45 (unmodified search.php) elseways it's what between <!-- ÊÎÄ ÏÎÈÑÊÀ / ÍÀ×ÀËÎ / ÌÎÆÍÎ ÍÀ×ÀÒÜ ÂÛÄÅËÅÍÈÅ ÄËß ÊÎÏÈÐÎÂÀÍÈß --> and <!-- ÊÎÄ ÏÎÈÑÊÀ / ÊÎÍÅÖ / ÌÎÆÍÎ ÇÀÊÎÍ×ÈÒÜ ÂÛÄÅËÅÍÈÅ È ÊÎÏÈÐÎÂÀÒÜ -->, with this:
Code:
<div class="cn_komform">

<form method="get" action="<?=$_SERVER['PHP_SELF']; ?>"">

<p><input name="do" type="hidden" value="search" /></p>

<ol>

    <li>

      <label for="search">Searchword<em>*</em></label>

      <input type="text" id="search" name="search" value="<?=$search; ?>" />

    </li>

    <li>

      <label for="category">Category</label>

      <select id="category" name="category"><option value="">All</option><?=category_get_tree('&nbsp;', '<option value="{id}"[php]search_this_cat({id})[/php]>{prefix}{name}</option>'); ?></select>

    </li>

    <li>

      Date (day/month/year)<?=makeDropDown($syear, 'year', $year); ?>/<?=makeDropDown($smonth, 'month', $month); ?>/<?=makeDropDown($sday, 'day', $day); ?>

</li>

    <li>

     <input type="submit" id="submit" name="submit" value="Search" />

    </li>

      </ol>

</form>

      </div>


That's the html output of the form.

Now to the styling. This is done in your external .css file



step 2

The css-code should be something like this:

Code:
.cn_komform {

   width: 22em;

}

.cn_komform li {

   list-style: none;

   margin: 0;

   padding: 0.25em;

   width: 100%;

    clear: both;

}

.cn_komform label {

       float: left;

}

.cn_komform input, .cn_komform select {

   float: right;

   min-width: 4em;

   max-width: 9em;

}



.cn_komform textarea {

   height: 6em;

   width: 30em;

}


Of course this might be subject to editing to your needs.



step 3

Fix some hmtl 4 things to be valid as xhtml:

line 25, search.php - change selected to selected="selected"

line 127, search.php - change selected to selected="selected"

line 122, functions.inc -change selected to selected="selected"



step 4

edit news-template in the commentform area to this:

Code:
<div class="cn_komform">

  <ul>

    <li>

      <label for="name">Name<em>*</em></label>

      <input type="text" id="name" name="name" class="tekst" />

    </li>

    <li>

      <label for="mail">URL/Mail</label>

      <input type="text" id="mail" name="mail" class="tekst" />

    </li>

    <li>

      {smilies}

</li>

<li>

      <textarea id="comments" name="comments" rows="4" cols="30" class="tekst"></textarea>

    </li>

    <li>

     <input type="submit" id="submit" name="submit" value="Add comment" />

    </li>

      </ul>

<br />     

</div>

note this is just suggestions, you may want to change the number of rows, cols etc...



step 5

open show.commentfor.php

change

line 36 - make the checked to checked="checked"

the bottom form, replace with:
Code:
<form id="comment" method="post" action="<?=$PHP_SELF; ?>"><?=$output; ?>

<p><input type="hidden" id="action" name="action" value="addcomment" /></p>

<p><input type="hidden" id="id" name="id" value="<?=$id; ?>" /></p>

<p><input type="hidden" id="ucat" name="ucat" value="<?=$ucat; ?>" /></p>

<p><?=$user_post_query; ?></p>

</form>




step 5

Add encolsing /> to all the inputs in the form from line125 to 138 in show.addcomment.php. Remember the space before />.



step 6

Turn of sessions in head.php by changing define('session', true);" to "define('session', false);



step 7

If some of you uses the cn _calendar function, you've noticed it's a 98 error monster if you try to validate it... some late nights and I actually managed to fix it, a bit proud... Some might say that it's still in tables, hey don't push your luck, that is way too difficult for me, and maybe a calendar is tabular data anyway?

anyways, replace the code in "function calendar" in plugins/etc.php starting from $buffer = '<table id="calendar"> to the end of the function, ie. before the "function lang" begins, with this code:
Code:
   $buffer = '<table id="calendar">

   <tr>

    <td colspan="7" class="month">'.$tomonth['prev'].'<a href="'.cute_get_link(array('date' => $first_of_month), 'month').'" title="'.lang(date('n', $first_of_month), 'month').date(' Y', $first_of_month).'">'.lang(date('n', $first_of_month), 'month').' '.$cal_year.$tomonth['next'].'</a></td>

   </tr>

   <tr>

    <th class="weekday">'.lang(1, 'weekday').'</th>

    <th class="weekday">'.lang(2, 'weekday').'</th>

    <th class="weekday">'.lang(3, 'weekday').'</th>

    <th class="weekday">'.lang(4, 'weekday').'</th>

    <th class="weekday">'.lang(5, 'weekday').'</th>

    <th class="weekend">'.lang(6, 'weekday').'</th>

    <th class="weekend">'.lang(7, 'weekday').'</th>

   </tr><tr>';



   if ($weekday > 0){

      $buffer .= '<td colspan="'.$weekday.'">&nbsp;</td>';

   }



   while ($maxdays > $cal_day){

      if ($weekday == 7){

         $buffer .= '</tr><tr>';

         $weekday = 0;

      }



      # Â äàííûé äåíü åñòü íîâîñòü

      if ($events[$cal_day]){

         $date['title'] = langdate('l, d M Y', $events[$cal_day]);

         $link = cute_get_link(array('date' => $events[$cal_day]), 'day');



         if ($weekday == '5' or $weekday == '6'){ // Åñëè ñóááîòà è âîñêðåñåíüå. Ñëàâà ÊÏÑÑ!!!

            if ($day == $cal_day){

               $buffer .= '<td class="weekend"><a href="'.$link.'" title="'.$date['title'].'"><b>'.$cal_day.'</b></a></td>';

            } else {

               $buffer .= '<td class="endday"><a href="'.$link.'" title="'.$date['title'].'">'.$cal_day.'</a></td>';

            }

         } else { // Ðàáî÷èè äíè. Âïåð¸ä, ñòàõàíîâöû!!!

            if ($day == $cal_day){ // àêòèâíûé

               $buffer .= '<td class="weekday"><a href="'.$link.'" title="'.$date['title'].'"><b>'.$cal_day.'</b></a></td>';

               } else {  // ïàññèâíûé, äóðàøêà

               $buffer .= '<td class="day"><a href="'.$link.'" title="'.$date['title'].'">'.$cal_day.'</a></td>';

         }

         }

      } else { // Â äàííûé äåíü íîâîñòåé íåò. Õóéîâûé äåíü...

         if ($weekday == '5' or $weekday == '6'){ // äíè, êîãäà ïî òåëåêó íèõóÿ íåò :(

            $buffer .= '<td class="endday">'.$cal_day.'</td>';

         } else { // ðàáîòÿãè õëåùàò âîäêó ïîñëå òðóäà

            $buffer .= '<td class="day">'.$cal_day.'</td>';

         }

      }



      $cal_day++;

      $weekday++;

   }



   if ($weekday != 7){

      $buffer .= '<td colspan="'.(7 - $weekday).'">&nbsp;</td>';

   }



return $buffer.'</tr></table>';

}






TODO

Fix the date dropdown

List the ways to fix all that I forgot for now, but it's late and I need some sleep Wink

Find out if theres a way to fix session unvaliding without having to turn it off in head.php

More to come Very Happy

Hey FI-DD let me know if you'd rather have all this code in a pastebin or something, if you think it's to messy with loads of codechunks in one post Wink

_________________
My cute.ru site
Wed Sep 27, 2006 11:22 pm View user's profile Send private message Visit poster's website
Guest








Please login to hide the ads.

sempro



Joined: 27 Apr 2006
Posts: 72

Post Reply with quote
Quote:
calendar is tabular data anyway?




Yes, It does Wink



It's must use table.
Thu Oct 12, 2006 12:31 pm View user's profile Send private message
Saszoo



Joined: 07 Jun 2006
Posts: 409
Location: Norway

Post Reply with quote
ok, well then it's fine. And now it's valid xhtml too!

_________________
My cute.ru site
Thu Oct 12, 2006 6:20 pm View user's profile Send private message Visit poster's website
nam



Joined: 23 Dec 2006
Posts: 98

Post CN problem with valid XHTML Reply with quote
I am trying to make CN output code valid XHTML, but face a number of problems.

In many of my templetes I have lins which have "&" in it, which is not valid XHTML and should be "&amp;" even in the URL.

But the problem is that even when I change it in the templete, after saving it saves it like before, I mean it automatcially chagne "&amp;" back to "&".

So I don't know what to do.
Sat May 24, 2008 4:55 am View user's profile Send private message
Display posts from previous:    
Reply to topic    Forum Index » Suggestions All times are GMT + 1 Hour
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum



Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Music Lyrics.