ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Setting variables on/off in a post

November 28, 2007 5:21pm

Subscribe [2]
  • #1 / Nov 28, 2007 5:21pm

    nosidam

    9 posts

    My company is currently evaluating EE to replace a 500+ page somewhat static site.  EE seems to do at least 90% of what we’re looking for, but we’ve sort of run into a small speed bump.  I’m sure there is a more elegant way of doing what we’re thinking, but wrapping my little brain around the major paradigm shift that would be EE is giving me a headache.  Here’s the background:

    While the current site is mostly static, it is written in PHP and code reuse is used as much as possible (i.e. headers, footers, logos, menus, etc.).  Some of the pages load various JS libraries, but to make loading faster, we only load the JS libraries if the individual page needs it (i.e. load lightbox if it’s a gallery page only).  Other pages do not need certain other modules and page elements loaded.  We accomplish this by defining about 10 PHP variables at the top of each static page and setting them on or off depending on if the page needs it or not, and loading them or not in the header based on the variables.

    We’d like to continue the same sort of idea in EE, if possible.  I’d love to be able to create custom fields in a weblog that are of type checkbox, but that doesn’t seem to be an option.  The only way I can think to do what I want is to create a textarea custom field and set the PHP variables in that field, and turn on PHP processing in the header template (which would save time since I could use the existing code).  Is this the best way or is there a more elegant solution?

    Thanks for the assistance as we continue to evaluate EE.

  • #2 / Nov 28, 2007 5:23pm

    Lisa Wess

    20502 posts

    Greetings, nosidam, welcome to the forums!

    I wouldn’t use the weblog entries for this, honestly - you’ll simply be adding a lot more overhead rather than reducing it, by using what is essentially a tricky workaround. You do, however, have a few options. You can enable PHP and use your own variables, use embedded templates, or the new Fresh Variables module, and do conditionals based on segment to load things based on what type of page you are visiting.

  • #3 / Dec 02, 2007 11:02am

    Bruce2005

    536 posts

    I’ve been redoing my own site with the same idea. As Lisa says, I was a bit concerned about the overhead, but went ahead and did it anyways.

    So far I have around 7 or 8.
    As I have a lot of EE demos, maps, different kinds of video, ajax etc etc in different pages, I use code and scripts in the templates which for most pages I don’t want loaded if not required, including per entry sidebar content.

    So using custom fields I added conditionals to include/exclude the scripts and links. I came across the checkbox extension, which works very well for some things.

    So far I haven’t noticed enough of a speed difference to concern me, but I’d test it to see for sure in other cases.

    Along this line, for some custom content I use a separate template so that the entire site doesn’t have a lot of overhead. So I have separate templates for a video area, a maps area etc…where they aren’t separate weblogs.

    Also am looking at Fresh Variables which looks interesting…
    .

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases