开发者

Dynamically changing page titles w/ PHP & MySQL

The way my website is set up, every page includes header.php to connect to our mysql database, and set up the header/boring html stuff (head, styles, scripts, etc).

After header.php is included, each page uses different queries to access the information that that page needs. My problem is that th开发者_StackOverflow社区e page title (<title></title>) depends on the information in the database, and by the time I get that information the title tags are already set in header.php.

Is there any way I could get around this?


Using a templating engine such as smarty (and others) is one solution, then you can wait until you have all your data loaded before rendering your header.

A templating engine is the correct way to do what you want to do.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜