|
Re: Dynamic Titles: msg#00001php.tcphp
Two ways this can be done: Output buffering, which you are already using. Template system that calls the template after the program logic. Like smarty. On Mon, 14 Mar 2005 23:25:23 -0600, Chris Mielke <dimen-fFZWkXJO8nJLUkrNk8DlHVaTQe2KTcn/@public.gmane.org> wrote: > Hey, > I was wondering if anyone knew of any ways to make it so that I can make > dynamic titles on my webpages using information that appears later on in the > code, while keeping it valid code and having the title in the header. So, > the code, as I currently have it looks like the following: > > //header information > echo("<title>Some Title :: " . $dynamic_title . "</title>"); > > //Rest of body include a part that would pull what should go in > $dynamic_title > > One thing that I have looked at using is ob_start(), but it will output > things before I flush it or use ob_get_contents() the way I have the site I > am doing this on set up. Let me know if the wonderful users here have any > ideas. > > ----------------------------------------------------- > Christopher Mielke > Graphic <BLOCKED::http://www.d.umn.edu/art/program/bfagraphic.html> Design > and German <BLOCKED::http://www.d.umn.edu/fll/German/germanstudies/> Major > University of Minnesota - Duluth <BLOCKED::http://www.d.umn.edu/> > > <BLOCKED::http://www.idimensia.com/> iDimensia.com > SetMeAway.com <BLOCKED::http://www.setmeaway.com/> > UMDLife.com <BLOCKED::http://www.umdlife.com/> > > PHP Tip (ob_start): > Can be used to parse some HTML or other information. Can also be used to > output a buffer to a file. Here is the code for an example used at > http://www.idimensia.com/index.php?mode=web > <BLOCKED::http://www.idimensia.com/index.php?mode=web> > > <?php > > function replace($html) > { > $html = str_replace('PHP', '<acronym title="Hyperhtml > Preprocessor">PHP</acronym>', $html); > $html = str_replace('MySQL', '<acronym title="A form of Structured Query > Language">MySQL</acronym>', $html); > $html = str_replace('Flash', '<acronym title="An web tool that can be used > for animation and interactivity">Flash</acronym>', $html); > $html = str_replace('CSS', '<acronym title="Cascading Style Sheets - Used > for design and layout.">CSS</acronym>', $html); > $html = str_replace('Deutschland', '<acronym title="German word for > Germany">Deutschland</acronym>', $html); > return $html; > } > > ob_start(); > > ?> > <title>iDimensia {Web}</title> > <h1>{Web} > </h1> > <hr> > <a href=" <BLOCKED::http://www.setmeaway.com> http://www.setmeaway.com" > target="_blank"><img src="images/Web/SetMeAway_t.jpg" width="90" height="70" > border="0" id="imgfloatleft"></a><strong><a href=" > <BLOCKED::http://www.setmeaway.com/> http://www.setmeaway.com/" > target="_blank">SetMeAway.com</a></strong><br> > SetMeAway is a website designed to find you your favorite away message. It > uses both PHP and MySQL to achieve this. Feel free to register and add some > of your favorite away messages. <br /> > <hr /> > <a href=" <BLOCKED::http://sleep.idimensia.com/> > http://sleep.idimensia.com/" target="_blank"><img > src="images/Web/Sleep_t.jpg" width="90" height="56" border="0" > id="imgfloatleft"></a> <strong><a href=" > <BLOCKED::http://sleep.idimensia.com/> http://sleep.idimensia.com/" > target="_blank">GiveSleepAChance.com</a><br></strong>A group project where I > did all of the site programming, including the use of CSS, PHP, and MySQL. > As a group we came up with the design of the site and the parts of the site. > The other members of the group did many of the graphics, including the logo > and the t-shirt designs. > <hr /> > <a href=" <BLOCKED::http://boxer.idimensia.com/> > http://boxer.idimensia.com/" target="_blank"><img > src="images/Web/Boxer_t.jpg" width="90" height="56" border="0" > id="imgfloatleft"></a> <strong><a href=" > <BLOCKED::http://boxer.idimensia.com/> http://boxer.idimensia.com/" > target="_blank">Boxerless</a><br></strong>This site was a project with very > few limitations. Although it is called Boxerless, it is a site to sell > custom made boxer shorts. The boxer shorts have not been mass produced yet, > but it is being researched. The site uses PHP, MySQL and CSS. > <hr /> > <a href=" <BLOCKED::http://www.umdlife.com/> http://www.umdlife.com/" > target="_blank"><img src="images/Web/UMDLife_t.jpg" width="90" height="56" > border="0" id="imgfloatleft"></a> <strong><a href=" > <BLOCKED::http://www.umdlife.com/> http://www.umdlife.com/" > target="_blank">UMDLife</a><br></strong>An extremely dynamic page that > allows a couple of files to design hundreds of pages. It is set up with both > PHP and MySQL, so that the administrator does not need to know HTML. > <hr /> > <a href=" <BLOCKED::http://www.coopnwf.org> http://www.coopnwf.org"><img > src="images/Web/nwf_t.jpg" width="90" height="56" border="0" > id="imgfloatleft"></a><strong><a href=" <BLOCKED::http://www.coopnwf.org> > http://www.coopnwf.org" target="_blank">University Co-Op Presents the Cohen > New Works Festival</a></strong><br />A site that I designed for the > University of Texas at Austin. They wanted a site that was able to be > updated without any HTML knowledge. They also wanted a new logo for their > festival which is in April 2005. The site uses both MySQL and PHP to allow > for the content to be easily updated. This is the end-product of the work > that I did for them. > <hr /> > <a href=" <BLOCKED::http://potsdam.three-dimensions.com> > http://potsdam.three-dimensions.com"><img src="images/Web/Potsdam_t.jpg" > width="90" height="52" border="0" id="imgfloatleft"></a><strong><a href=" > <BLOCKED::http://potsdam.three-dimensions.com> > http://potsdam.three-dimensions.com" target="_blank">Graffiti in > Deutschland</a></strong><br> > Designed during and after a trip in Germany. It has a photo gallery with > many images of Germany, as well as a couple articles written about how > different Graffiti was used in Germany with some comparison to the US. > > <?php > echo(replace(ob_get_clean())); > ?> > > |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Dynamic Titles: 00001, Chris Mielke |
|---|---|
| Next by Date: | Re: Dynamic Titles: 00001, Daniel J Cain Jr. |
| Previous by Thread: | Dynamic Titlesi: 00001, Chris Mielke |
| Next by Thread: | Re: Dynamic Titles: 00001, Daniel J Cain Jr. |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |