[SOLVED] Documentation and how to add new content boxes?

Post Reply
Florrpan
Posts: 8
Joined: Sun Mar 23, 2014 9:30 pm

[SOLVED] Documentation and how to add new content boxes?

Post by Florrpan »

I looked everywhere, but I can't really find any documentation, would be awesome if there was a little documentation about this:

In the index.php file, I found all the variables and figured I could simply do this:

Add PHP:

Code: Select all

$c['testbox1'] = 'This is a textbox';
$c['testbox2'] = 'This is a textbox';
$c['testbox3'] = 'This is a textbox';
Add HTML/PHP

Code: Select all

            <div class="col-33">
               <?php content('testbox1', $c['testbox1']); ?>
            </div>
            <div class="col-33">
               <?php content('testbox2', $c['testbox2']); ?>
            </div>
            <div class="col-33">
               <?php content('testbox3', $c['testbox3']); ?>
            </div>
Is this the correct way? Is there a more effective way to do this?
For example doing like this:

Code: Select all

$c['testbox'] = 'This is a textbox';
And when adding content on the website, I could create and load new and separate files like this(using only one variable);

Code: Select all

            <div class="col-33">
               <?php content('testbox1', $c['testbox']); ?>
               <?php content('testbox2', $c['testbox']); ?>
               <?php content('testbox3', $c['testbox']); ?>
            </div>
Actually, doing it like this DOES create a new file called "testbox" (3 different files)
But WonderCMS do not actually load the each separate file, instead, it loads the "textbox" file only, which means every input have the same content.
Also, doing like this actually bugs out the WYSIWYG editor 0.1 [BETA], which is kinda sad.

Another problem is that this same content do appear on all pages, so is there a way to create page-specific content?
Tell me if i'm doing this right, or if there is a more correct way to do this. Thanks!

User avatar
wiz
Admin
Posts: 749
Joined: Sat Oct 30, 2010 12:23 am

Re: No documentation? How to correctly add new content boxes

Post by wiz »

Hi Florrpan, documentation is already on it's way, it will take some time to dispatch it.

The intended way of doing it (for now) is: opening your index.php
ADDING:

Code: Select all

$c['mytopbar'] = "Some content.";
$c['mysiderbar'] = "Some more content.";
and editing your theme.php which each content in it's own <div> and id="something" (if it's a div without an id, it will make half of your page click-able, the editing process has to assign it to some id).

Code: Select all

		<div id="yourid">
			<?php content('mytopbar',$c['mytopbar']);?>
		</div>

		<div id="yourotherid">
			<?php content('mysidebar',$c['mysidebar']);?>
		</div>
Although this will not solve the content being shown on other pages (as WonderCMS doesn't currently support this). But I personally think it's do-able.
You could solve this with hiding and showing content with jQuery (logical example: "if page home, show "siderbar 1", if page "about", hide "siderbar 1" and show "siderbar 2"...).

Make sure your newly created editable areas have id's, that way your WYSIWYG should work normally (aside from the current bugs it has).

Post Reply