Re: Adding a new feature.

"Paul E. Ross" <[email protected]>
Newsgroups gmane.comp.apache.mod-layout
Message-ID <[email protected]>
Scott Savarese wrote:
> I don't know if this already exists in mod_layout, but if not I would like
> to try implementing it, and would like help... If it is in there, can
> somebody tell me how to do it?
> 
> I have a website (duh?) that uses a template to create a left margin and
> top header as a template. I can very easily take mod_layout and use it to
> put a header on top of the content and the closing footer at the bottom of
> the content. That will provide me with most of what I need...
> 
> However I would like to preserve the title fields in the content and place
> it in the template at various places. For instance, my template currently
> takes the title tag out of the html and inserts it into various points in
> the template so that the title appears in my title bar as well as part of
> my top header... I like how that looks...
> 
> So, I was wondering if I can add a tag... say 'LayoutKeepTag "<title>"'
> which when implemented looks for the contents of the title tag in my html
> and then looks for a matching tag in the template code. If it finds a
> matching tag it replaces the contents with what was in the previous html.
> 
> Did I explain that well? If not sorry... I am trying to get a handle on
> how mod_layout works but my C isn't as good as it used to be (I do perl
> much better). If anybody could help me implement something like this it
> would be great... I've already read some apache books on writing modules,
> especially output filters, but when it comes to implementing it now I am
> totally lost.
> 
> Thanks,
> Scott
> 
> 
> 
> _______________________________________________
> Mod_layout mailing list
> [email protected]
> http://lists.tangent.org/mailman/listinfo/mod_layout
> 
> 

I have this already at my site.

A) the header.php file prints out a header and sets up a table, the
lefthand cell of which is my menu, the right hand cell is the requested
page.  the footer closes the table.

B) while generating the header, the first things "printed" are the
standard <HTML><HEAD><TITLE>, after which, I grab the title from the
requested page and print that, then close the </TITLE> and continue
generating the pretty pictures and top level menu.

/*                                                                      */
/**     determine a page title so the user's history will              **/
/**   have something usefull in it                                     **/
/*                                                                      */
    $Page_Title = 'Raytheon Company Intranet';
    $temp = $parse_temp = $description = '';
    if (is_dir("$Current_Directory/RCS") &&
file_exists("$Current_Directory/RCS/$
page,v"))
    {
       $description = exec ("rlog -t $Current_Directory/$page | grep -v
\":\" | g
rep -v \"^=====\" | grep -v \"^\$\"");
    }
    if ($description == '')
    {
       if (file_exists("$Current_Directory/$page") && $handle =
fopen("$Current_D
irectory/$page", 'r'))
       {
          $temp = fread($handle,4096);
          $parse_temp = spliti ('title>', $temp);
          $temp = ltrim($parse_temp[1]);
          $parse_temp = split('<', $temp);
          $description = rtrim($parse_temp[0]);
          if (eregi ('parse_temp', $description))
          {
             $description = '';
          }
       }
    }
    if ($description != '')
    {
       $Page_Title = $description;
    }
    print "   <TITLE>\n   $Page_Title\n   </TITLE>\n\n";


-- 
Paul Ross
Senior Software Engineer
281.280.2997
281.280.4138 fax
713.736.9581 pager
[email protected]
http://www.shibumi.org/eoti.htm
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.