Well, I've used it before, but the thing is that I want to learn how to make my own template class. I've worked with classes before, but my knowledge about making it support nested blocks like phpBB's does, then it's not going well. I would have used phpBB's if it wasn't that I wanted to learn how to do...

    yes, your mail was there... sorry, but I'll have to decline both the job offer and your offer to make a template class.

      why?!?! we are great company come and see man! portals...

        I'm in the middle of a project and will not desert it! Sorry!

          after your done?, what project? maybe I can help!!!

            sorry, we're not accepting any more workers...

              so can you work with us after your so called project, i doubt itll even work, the code...

                why!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! i really need a programmer, i prolly cant pay you 10/hour, but maybe 5?

                  well i bet your coding doesnt even work@! i bet you dont even know how to program!

                    HEY, stop insulting me! I've been coding PHP/MySQL for about 6 months now, and you don't know SHIT about me!!! :mad:

                      gTpl v1.0.1 - A template class I made b[/b]

                      <?  
                      class gTpl
                      {
                      var $vars; function new_var( $var, $value ) { $this->vars1[] = '{' . $var . '}'; $this->vars2[] = $value; } function parse( $file ) { if( !file_exists( 'tpl/tpl/' . $file ) ) die( 'Template File doesn\'t exist.' ); $tmp = implode( '', file( 'tpl/tpl/' . $file ) ); $tmp = str_replace( $this->vars1, $this->vars2, $tmp ); eval( '?>' . $tmp ); } }
                      ?>

                      Example of how to use: b[/b]

                      <?  
                      require( 'gtpl.php' ); $gtpl = new gTpl; $gtpl->new_var( 'title', 'My Homepage' );
                      $gtpl->new_var( 'text', 'The text on my homepage' );
                      $gtpl->new_var( 'author', 'YourName' ); $gtpl->parse( 'test.tpl' );
                      ?>

                      This is how test.tpl will look like (an example): b[/b]

                      <html> 
                      <head> 
                      <title>{title}</title> 
                      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
                      </head>  
                      
                      <body bgcolor="#FFFFFF" text="#000000"> 
                      <table width="600" border="0" cellspacing="0" cellpadding="0" align="center"> 
                        <tr> 
                          <td bgcolor="#0000FF" height="57"> 
                            <div align="center"><b><font size="6" color="#FFFFFF">{title}</font></b></div> 
                          </td> 
                        </tr> 
                        <tr> 
                          <td bgcolor="#FFFFFF">{text}</td> 
                        </tr> 
                      </table> 
                      <div align="center"> 
                        <br> 
                        {author} 
                      </div> 
                      </body> 
                      </html>
                      

                        free2code

                        Im gonna stick up for rIkLuNd. You shouldnt be insulting anyone on the board.

                        If your so in need of a programmer post around, and you must learn to take no as an answer.

                          Thanks Intenz for the reply, but that's not what I need help with. I'm going to be as clear as possible as to what I want. If you open the index_body.tpl file in phpBB, let's say the subSilver folder, then you will find some code that looks something like this:

                          <!-- BEGIN catrow -->
                            <tr> 
                          	<td class="catLeft" colspan="2" height="28"><span class="cattitle"><a href="{catrow.U_VIEWCAT}" class="cattitle">{catrow.CAT_DESC}</a></span></td>
                          	<td class="rowpic" colspan="3" align="right">&nbsp;</td>
                            </tr>
                            <!-- BEGIN forumrow -->
                            <tr> 
                          	<td class="row1" align="center" valign="middle" height="50">
                          <img src="{catrow.forumrow.FORUM_FOLDER_IMG}" width="46" height="25" alt="{catrow.forumrow.L_FORUM_FOLDER_ALT}" 
                          title="{catrow.forumrow.L_FORUM_FOLDER_ALT}" /></td>
                          	<td class="row1" width="100%" height="50"><span class="forumlink"> <a href="{catrow.forumrow.U_VIEWFORUM}" class="forumlink">{catrow.forumrow.FORUM_NAME}</a><br />
                          	  </span> <span class="genmed">{catrow.forumrow.FORUM_DESC}<br />
                          	  </span><span class="gensmall">{catrow.forumrow.L_MODERATOR} {catrow.forumrow.MODERATORS}</span></td>
                          	<td class="row2" align="center" valign="middle" height="50"><span class="gensmall">{catrow.forumrow.TOPICS}</span></td>
                          	<td class="row2" align="center" valign="middle" height="50"><span class="gensmall">{catrow.forumrow.POSTS}</span></td>
                          	<td class="row2" align="center" valign="middle" height="50" nowrap="nowrap"> <span class="gensmall">{catrow.forumrow.LAST_POST}</span></td>
                            </tr>
                            <!-- END forumrow -->
                            <!-- END catrow -->

                          Then the template class repeats these blocks as many times as it's needed. That is what I need help with!

                            I actually think its just the same as {template}

                            Basically looking at that for 1min im guessing that the
                            <!-- BEGIN catrow -->

                            Would be found and intiated as the start of the loop..

                            The next bit which gets gathered is the forum loop.. So they look for that bit

                            then they end them..

                            And like you said they go as many times as they need to.

                              A great thanks to all of you that have been helping me, but I solved it! Thanks again!

                                Write a Reply...