开发者

How can I easily change the text on a page using zend framework and php

What I am looking for is something where I can easily change the text on a page. I want to set it to a default value and if something is present for a specific page to change it

So it would say something like:

I like stackoverflow

But if the value of website was "reddit" it would instead say

I like reddit

So stackoverlflow would be the default, reddit would be something that is set to overwri开发者_如何学Pythonte it.

edit:added comment


Scenario I: Domain Name based data handling If you want to work on the basis of domain, then in Zend Framework you can work with customize routers.

Scenario II: GET/POST based input handling Otherwise if you want to display on the basis of GET or POST input you can place something default value as $myDynamicVar = $this->getRequest()->getParam('some_key', 'default-value');

Scenario III: subdomain based input handling Again you will need to have your custom router for the purpose, in addition to having support of wildcard subdomain names with your hosting provider


In a definitions file:

<?php 
/* site.php
 * customize this file 
 */
class Site 
{
    static public $name = "stackoverflow"; 
}
?>

In your page file:

<?php
/* page.php */
include_once 'site.php';
echo "I like {Site::$name}";    
?>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜