Global Vars ( for custom themes )

Permalink
So as an example:

<?php
$a = new GlobalArea('Site Name');
$a->display();
?>

Renders as:
<h1>
<a href="/" title="Home">SomeTextHere</a>
</h1>

So I am guessing , that I can copy across a config file from core, into my theme to override certain vars, or perhaps its done via a locale file, like other frameworks.

I wish to change certain vars ( I am assuming you call them vars ) but only within my theme. I do not want to edit ANY files outside of the theme.
For example, the one I have itemised above for some obscure reason has no id or class, plus is wrapped in a h1 ( which I may want to change ) so wondering where I can make changes to this, globally, outside of core config.

Thanks 2nd Thread

422
 
JohntheFish replied on at Permalink Reply
JohntheFish
Site name is adjusted through the dashboard.

For general storage you can use the config table.
http://www.concrete5.org/documentation/how-tos/developers/use-the-c...
JohntheFish replied on at Permalink Reply
JohntheFish
You can make theme css configurable through the dashboard (I guess you already know how to do that).

For other theme specific variables, you could use page attributes or add a single page to edit your own set of variables via the dashboard.
422 replied on at Permalink Reply
422
No guys sorry not making myself clear, neither a css issue or renaming convention.

<?php
$a = new GlobalArea('Site Name');
$a->display();
?>

renders...

<h1><a href="/" title="blah">Sometext</a></h1>

Somehow this is constructed, and I would like to be able to change it, in my own ( locale or config somehow )

So I could at will change it to example:

<a class="this" id="that" href="/" title="blah">Sometext</a>

Add class, add id, remove header wrap tags etc etc

ANd i need to do this programatically and not via addClass etc
ronyDdeveloper replied on at Permalink Reply
ronyDdeveloper
You can try this:

<a href="<?php   echo BASE_URL.DIR_REL?>/">
<h1><?php   echo SITE?></h1>  <!-- You can replace h1 tag with any other html tag -->
</a>


Rony
422 replied on at Permalink Reply
422
Cheers Rony.

But still confused, I know your schema is a workaround, but I prefer to work with the code structure as is, where possible.

I am presuming

<?php
$a = new GlobalArea('Site Name');
$a->display();
?>

GlobalArea defines a particular set of conditions, just at a loss to see where and how it is constructed to disect it, and then advice on how to override, in a new config file within our theme.
ronyDdeveloper replied on at Permalink Reply
ronyDdeveloper
The code is coming from a schema.

<stack name="Site Name" type="global_area">
    <area name="Main">
      <block type="content" name="">
        <data table="btContentLocal">
          <record>
            <content><![CDATA[<h1><a title="Home" href="{ccm:export:page:}">{ccm:export:define:SITE}</a></h1>]]>
            </content>
           </record>
         </data>
       </block>
     </area>
</stack>


The path is ROOT/concrete/config/install/packages/standard/content.xml at line no 207 (Approx).

Rony
422 replied on at Permalink Reply
422
Thanks again Rony,

Slightly confusing system, I suppose it is because of Concrete5's edit modes.

I really think I am gonna have to rip the whole thing apart to see how this all works. As it stands, I am not sure how portable some of the globals are for theme developing.

Primary example:

<?php
$a = new GlobalArea('Header Nav');
$a->display();
?>

This is gonna get me really confused creating dynamic menus, I guess I will have to hard code it in somehow, will keep looking ... thanks
VidalThemes replied on at Permalink Reply
VidalThemes
Hi 422

I am assuming your coming from a different CMS, welcome to Concrete5, areas in C5 are totally overidable as they are, there are some global areas that already grab data, like the header name and nav, but you by no means have to use them (unless your building for the marketplace)

for example:

<?php
$a = new GlobalArea('Site Name');
$a->display();
?>


could be changed to:

<?php
$a = new GlobalArea('My Awesome Name');
$a->display();
?>


Then you can add your site name or logo to the stack "My Awesome Name" in your C5 dashboard and it will be displayed every place the area is called. The above code you are quoting simply creates an editable area with your theme, you can put whatever you like in it.

The nav is the same deal really, no need to hardcode autonav unless you really want to, This:

<?php
$a = new GlobalArea('Header Nav');
$a->display();
?>


Will still render an unordered list with a class name and individual li's, its just a case of styling it then.