views:

56

answers:

2

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 overwrite it.

edit:added comment

A: 

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}";    
?>
Ewan Todd
A: 

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

r0ash
okay, I think Scenario #2 is real close. I would have a file with all of the normal wording entered, however for an event that had different language I would want to store that into the DB. What would be the best way to do it so I could just do something like $this->variableName; and it would automatically look based on eid if there was a replacement and if not it would give me the regular value.
Joe
Some more description to your problem could help pointing out the solution easier.However I believe that you simply want to display (for instance) 'Bonjour', if and only if its replacement is _NOT_ present in the database. From this perspective;<?php$var = "Bonjour";$dbValue = $db->queryResult("...where text='bonjour'");if (!empty($dbValue)) {$var = $dbValue;}
r0ash