#1 Re: Developer Help » Transforming field values with the parser » October 24, 2012 11:43am

I just had trouble with this yesterday. Great timing!

For a name input, by default you'll see something like this: {"last_name": "Doe","first_name": "John"} which is the `$value`.

To work with that in the parser function use json_decode($value, true). The true as the second parameter was the part throwing me off yesterday, as that's what converts the decoded json into an associative array.

Any data manipulation performed in the parser has to be re-assigned to `$value` to display in the module view.

So, to display "LastName, FirstName", the parser function would look something like this:

$new_value = json_decode($value, true);
$parsed_name = $new_value["last_name"] . ", " . $new_value["first_name"];
$value = $parsed_name;

#2 Re: General » Hello, all » October 9, 2012 12:33pm

There's no need to include less.js. BigTree uses lessphp http://leafo.net/lessphp/. File compilation, concatenation, and 'minification' occurs only on the first request after a component file is modified.
So, the first visitor to your site after you modify a LESS file will see slight performance hit on page load. All later visitors will be served he cached file, with no performance hit.




#3 Re: General » Hello, all » October 9, 2012 12:23pm

Hi Alex,

BigTree will auto-compile LESS if you include the file in $bigtree["config"]["css"]["files"]. Just make sure to use the .less file extension.

For example, the following will compile "less_file.less", combine it with "css_file.css", and cache the resulting file - in this case "compiled.css".
$bigtree["config"]["css"]["files"]["compiled"] = array(
    "less_file.less",
    "css_file.css"
)

#4 Re: Bug Reports » 500 Internal Server Error after Install on HostGator » August 6, 2012 8:08am

Sorry to hear that. I think you've got some server configuration issues to fix before BigTree will work for you. Unfortunately, I don't know that there's anything else we can do until the server is configured correctly.


If you decide to upgrade your shared-hosting to a VPS, check out Linode, Rackspace, Media Temple, or similar. With a dedicated virtual server, you'll have much greater control.

#5 Re: Bug Reports » 500 Internal Server Error after Install on HostGator » July 18, 2012 8:51pm

Hey swgamerx,

I just sent you an email regarding further steps to solve this problem.

Until it's worked-out, have you installed BigTree locally on MAMP / WAMP?

#6 Re: Developer Help » Trouble with 4.0 Beta 6 install on MAMP » July 14, 2012 7:51pm

Hey Oliver,

I can't replicate this issue, either on beta 6 or on beta 7 (https://github.com/bigtreecms/BigTree-C … evelopment). I'd recommend trying beta 7 for now, see if that eliminates the warning. We'll be able to look into this more on Monday morning.

Is the warning occurring immediately after install, at the site root, or elsewhere? Any additional information would be helpful.

Best,
Dylan

#7 Re: Bug Reports » BigTree on MAMP bugs » July 5, 2012 8:06am

Hi Maarten,

We've confirmed your bug and are working to resolve it. We'll let you know as soon as a fix is ready.

Best,
Dylan

#8 General » Installing on Windows / WAMP » May 7, 2012 3:33pm

Farnsworth
Replies: 3

We just pushed some updates to the development branch on github that enable BigTree to be installed on Apache, MySQL, PHP, in Windows. The WAMP setup used is the 32-bit install from http://www.wampserver.com/en/ running on Windows 7.

There are a few settings in WAMP that need to be modified for the install to go smoothly.

1. In php.ini, turn-on short open tags, and set upload_max_filesize to 8M or higher.

2. In httpd.conf, make sure AllowOverrides is set to All.

3. Restart all services to ensure your changes are working.

Those changes should have WAMP configured properly for BigTree.

#9 Re: Developer Help » Advice on "public" modules » April 14, 2012 3:18pm

I'd recommend having a look at the non-get functions in the BigTreeModule class and the utility functions in the BigTree class.
For example, in BigTreeModule checkout add() - which does three things. First, it checks for duplicate entries in the table associated with your module. Next it creates a new entry in your table with the given values. Finally, it caches the entry so it's viewable immediately through the admin.
In the BigTree class, functions like createThumbnail may be useful if you're making an image uploader.
Have a good weekend.

#10 General » Basic PHP for your Templates » April 10, 2012 3:04pm

Farnsworth
Replies: 1

Here are the BigTree functions most frequently used when creating templates.
Generic
Items in this list can be included in your template files by placing them inside php echo tags:
Page Resources

Page resources are pieces of content created in BigTree. Any page resource can be included in your tamplates by appending a dolar-symbol $ to the beginning of the resource id.
For example:


$page

Displays attributes from the current page. For example, $page["title"] would display the page title, as set in BigTree's "page properties" screen. Some frequently-used attributes include:

  • id

  • title

  • meta_keywords

  • meta_description

$www_root

Your site's URL.
$cms->
The BigTreeCMS class does most of the heavy-lifting for the front-end of your site. To access BigTreeCMS in your templates, use $cms-> before the function.
getLink()

Gets the full URL when given a page id (which can be found in the BigTree admin).
will give the full URL to page 2.
getSetting() and getSettings()

$cms->getSetting() to get the content of a single setting. For example, if you stored a contact email address as a setting, you might access it with $cms->getSetting("contact_email").
If you need to access multiple settings in a single template, use $cms->getSettings(), like this:$settings = $cms->getSettings(array(
    "contact_email",
    "contact_phone"
));

Use these settings in your template:

getNavByParent()

Use $cms->getNavByParent() to create your site's nav menus. See the Navigation documentation for more information.

BigTree::
The BigTree class contains many functions useful throughout the front and back of your BigTree site. To access this class in your templates, use BigTree:: folowed by the name of the function.
trimLength()

Control the length of content with BigTree::trimLength(). The function is smart enough not to count html tags against the length of your content.
For example: BigTree::trimLength($string, 150)

would trim the value of $string to 150 characters, appending an ellipsis to the end of the output.
prefixFile()

When you use BigTree to create prefixed crops or thumbnails of an image, you'll need BigTree::prefixFile() to access the resulting images. Pass in the file name or URL, and the desired prefix:
For example, to get prefix_image.png from http://example.com/images/image.png as $file:BigTree::prefixFile($file, "prefix_")

BigTreeModule->
Use the BigTreeModule to help work with your site's database. All modules you create will inherit from this class. So if you have a class BTXNews, access BigTreeModule functions by first instantiating BTXNews
$newsMod = new BTXNews; then using $newsMod-> followed by the function name.
getAll()

Get all entries from the given module. $newsMod->getAll() would give all entries from our news module.
getAllPositioned()

Get all module items ordered based on their position.
getApproved()

Get all approved module entries.
getFeatured()

Get all module entries that have been marked as featured.
getUpcoming()

Get all module entries with a date attribute greater than the current date.

#11 General » Using Links in Templates » April 6, 2012 11:00am

Farnsworth
Replies: 2

When building templates, it's a good idea to let BigTree generate your links. Because administrators have the ability to modify page URLs, avoiding hard-coded links keeps your site working properly.

To always link to a specific page, use $cms->getLink(), passing in the id if the page you're linking to. $cms->getLink() provides the full page URL, including http:// and a trailing slash. Read more about getLink().

$www_root always links to your homepage, including http:// and a trailing slash. Use $www_root when linking to static assets like stylesheets, javascript files, and uploads.

Finally, the "link" value returned by $cms->getNavByParent() contains a full URL for the related page. Read more about getNavByParent().

#12 Developer Help » Processing and Caching CSS and JS » April 3, 2012 9:50am

Farnsworth
Replies: 1

Caching
BigTree provides the ability to combine, minify, and cache frequently-requested js and css assets.Setup of caching is handled in the templates/config.php file. The cache is controlled on a per-output-file basis. For example, to combine normalize.css, functions.css, and widget.css into site.css, you would set the following in config.php:

$config["css"]["files"]["site"] = array(
    "normalize.css",
    "functions.css",
    "widget.css"
);
The first parameter passed to $config tells BigTree what type of files you're caching, and to look in the appropriate directory. The second says we're outputting a file, and the third parameter specifies the filename, without the file extension. Inside the array, simply list the files you wish to combine, in the same order they should be included. The cached file can be included in your site by linking to site.css in your css directory.

LESS
To include a LESS css file, just include it in the array, with the extension .less.

$config["css"]["files"]["site"] = array(
    "styles.less"
);
BigTree determines when to update the cache files based on the source files' file-time attribute, only re-writing the cache if a source file has been modified.

Variables
Since caching is handled through PHP, an added benefit of this feature is that BigTree can evaluate php variables within the source documents. By default all cached Javascript files will have www_root replaced by the url of your website root.

Additional variables can also be evaluated in the cached files. To assign colors globally, for example, an array of colors could be created:

$config["css"]["vars"] = array(
    "colorBlack  => "000000",
    "colorWhite"  => "FFFFFF"       
);
To access them in your javascript, set the javascript vars as well.

$config["js"]["vars"] = $config["css"]["vars"];
And accessed in the CSS as JS as:

// CSS:
.black  { color: #$colorBlack; }

// jQuery
$.("#element").css( "color" , $colorWhite );
Minification
Setting $config["js"]["minify"] or $config["css"]["minify"] to true will minify the concatenated files before they are saved.

#13 Developer Help » Sharing Template Resources » April 2, 2012 11:48am

Farnsworth
Replies: 0

In BigTree, page resources are template agnostic. Because resources are tied to pages, not templates, content is not deleted when switching to a new template, so long as the same resource id is used in both templates. Using a standard naming convention in all of you templates can save you, and your users, lots of work.

I preface all common resources with "page_". "page_header" and "page_content" in the majority of templates. "page_gallery", "page_intro", "page_subheader", etc. By using this naming convention, I can switch a page to a gallery template, for example, and not re-enter the heading and page content.

I'm sure there are other cool ways to take advantage of resource naming. Any thoughts?

Board footer

Powered by FluxBB

The Discussion Forum is not available on displays of this size.