Hello,

I have a task where I have to generate html pages for about 30 lakh pages. It is not much difficult, if all the pages had the same layout. My problem is that, not all the 30 lakh pages have the same layout. It keeps changing. For ex. I have nearly 350 different layouts. So, I will have to write different scripts for all those pages, which I don't want to do. Can a single script do the generation irrespective of the page layout. Anyone has a better idea, please do let me know.

Thanks in advance.

    what you actually mean "350 different layouts"??
    is your content dynamic?

      Yes. 350 different layouts(Templates) and another pain is that weekly I have to update these pages with the new data. The layouts remain the same but the content coming from the db changes.

        I haven't tried this myself, but Macromedia Dreamweaver have a site & template-function that might help you if you haven't tried it/checked it out....

        You can use nested templates as well.

        I'm not sure I understand your problem right, but if it's only the content from the DB that changes the content of the templates(not the layout) should update by itself(at least if you pick data from the same tables/rows/fields) or am i on a complete wrong track here ???

          To have a better idea of what I am asking for, take a look at the following example. This is just my idea, if it works out then well and good.

          //////// replace.html ////////////

                 <table>
              <tr>
                <td> <b>Name </b></td>
                <td> <b>Address</b></td>
              </tr>
              <tr>
                <td> <!-- Name start -->Hima</td>
                <td> Bindu  <!-- Name end --> </td>
                <td> <!-- Address start -->ABCDEF</td>
          	  <td> ABCDEF <!-- Address end --> </td>
              </tr>    
            </table>

          // End of replace.html

          -------The php program --------
          $Name="Ramani</td>
          <td> Prabhakar ";
          $Address="R.K.Puram</td>
          <td> Hyderabad ";
          $fp=fopen("replace1.html","r");
          while(!feof($fp))
          {
          $buffer=fgets($fp);
          $fcontent=$fcontent.$buffer;
          }
          if(ereg('<!-- Name start -->',$fcontent))
          {
          $strposs=strpos($fcontent,'<!-- Name start -->');
          $strposs=$strposs+strlen('<!-- Name start -->');
          $strpose=strpos($fcontent,'<!-- Name end -->');
          $fcontent=substr_replace($fcontent,$Name,$strposs,($strpose-$strposs));
          }
          if(ereg('<!-- Address start -->',$fcontent))
          {
          $strposs=strpos($fcontent,'<!-- Address start -->');
          $strposs=$strposs+strlen('<!-- Address start -->');
          $strpose=strpos($fcontent,'<!-- Address end -->');
          $fcontent=substr_replace($fcontent,$Address,$strposs,($strpose-$strposs));
          }
          fclose($fp);

          $fp=fopen("replace1.html","w");
          fputs($fp,$fcontent);
          fclose($fp);

          The above is the php code that tries to replace with the latest content. That is just an example so it looks easy. I have much complex pages to generate through my php code.

          I hope few of them can follow what am I asking for.........

            Sounds *&@#$%???

            Thats the reason, I would appreciate if some one has a better idea on it.

              I don't know if this will solve your problem but I figured I'd harp in...

              I wrote a CMS that allows for 3 nested templates.

              At least you won't have to RECODE for every layout change...you just make a new template for the record. The script does the rest. Another kewl thing I did was set it up so you could pull templates from local AND remote sources (for branding) although I haven't used it for branding yet. :-)

              Page (Site Identity page)
              Table (Table details and navigation)
              Record (field display)

              RECORDs nests to TABLE nests to PAGE.

              Each template is its own html file with keyword tokens within. The tokens are replaced with the content that is in the database / dir (depending on the call).

              If your layout ever changes, you simply create a html page with the new layout and update the html links to use the new template (or you can use the ini option and make the new template the default). The templates can be as fancy or as plain as you want.

              PLAIN (copy link into browser address bar)

              http://programming.shrum.net/mysqlcms.php?dir=/scripts&table=http://www.shrum.net/generic_table.shtml&record=http://www.shrum.net/dir_record_row.shtml&where=`type`='dir'&from=`flying_sites`&cols=1&limit=0,1000&icon=script&title=Scripts%20and%20Modules&order=`name`&sort=asc

              FANCY (not all that fancy but with images):

              http://soaring.shrum.net/mysqlcms.php?rowcolor2=ffffff

              You can take a look at the script I wrote (sort of a work in progress but I've been using it for my site for the last year or so). Use it if you want or at least get some ideas from it.

              Documentation is limited to code comments right now but I'll get around to documenting the various things later.

              GOTO:
              http://programming.shrum.net - Scripts - mysqlcms.php > mysqlcms.php.txt (for source)

              The folder will have a couple of files that show you what a typical template will look like. Take a look at the shtml files in that folder for ideas.

              If you have any questions feel free to ask.

                Write a Reply...