close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Modifying Framework Builder.

Thread began 6/12/2012 4:18 pm by neo314 | Last modified 6/13/2012 12:41 pm by neo314 | 1569 views | 4 replies |

neo314

Modifying Framework Builder.

I just posted something to the wish list HERE to which I thought I might ask if there is a way to do this now, or a modification I could make to framework.php that could accomplish this now.

To see more about why I want to accomplish this, see the thread linked above. What I would like to do is cause PHP code in the header of the template that is used for a theme to be executed BEFORE the PHP header code of the page the theme is applied to.

I took a look at the file and an answer does not jump out at me, but it seems the DOCTYPE is used as a breaking point, so it seems it should be possible.

Thanx,
Steven

Sign in to reply to this post

Jason ByrnesWebAssist

on the pages that are based on the theme, the code that defines the theme will look similar to this:

php:
if("" == ""){

    $WA_untitled_1339594149731_Content_Empty = "";
    $WA_untitled_1339594149731_Content = new WA_Include(__FILE__); 
    $WA_untitled_1339594149731_Template = new WA_Include("Templates{$WA_untitled_1339594149731_Content_Empty}/untitled.dwt.php");
    require($WA_untitled_1339594149731_Template->BaseName);
    $WA_untitled_1339594149731_Template->Initialize(true);
}



the code from the head of the template will be added where that code is in the page that uses the theme. Place the theme code before the other code in your page so the theme code will be executed before the page code.

Sign in to reply to this post

neo314

AWESOME!

It also seems to reveal something about how the output buffering is being handled. Maybe you could shed a little light on this.

My first test involved echoing "Template" and "File" to see which code cam first and it was always "File".

After your post I moved the Framework Builder (FWB) code to the top and echoed "File just below it. That resulted in ONLY "Template" in the output.

Now uncertain if the page code was being executed, I changed the statements so the template had $test .= " Template "; and the file code below the FWB code was $test .= " File "; I output the value of $test on the page and both values were present and in the desired order,
"Template File".

I tried another test with File1 before the FWB code and File2 below, and as expected, The screen output from the header is "File1 Template" but the value of $test is "File1 Template File 2".

So the header of the Template is always where the FWB code is in the header of the file, AND the file header code above the FWB code is executed first and output, BUT the header code below the FWB code of the file is executed AFTER any code in the header of the Template and any output from that code is scrubbed.

Correct?

Sign in to reply to this post

Jason ByrnesWebAssist

Using echo wont accurately show when code is firing. You should use die instead.

basically the page is being buffered as it is being created from the template and other plugins. This is done so that paths can be adjusted and such, only once the entire page is created is anything written to the screen, the order of the echoes wont really .

The template code is executed where the theme is instantiated, so moving the theme code block will ensure that the header code from the template is executed before the any code that comes after it.

Sign in to reply to this post

neo314

Thanks Jason,

I was initially looking for when output was being sent to the browser, but when I saw that was being altered, I used the variable and concatenated values to it to see when code was being fired. I thought it more efficient since exit stops execution and so I would have to move that around to test each stopping point.

So now my admin template has:

<?php require_once("../admin/security.php"); ?>



and the file security.php has the code:

if (!isset($_SESSION)) {
session_start();
}
require_once( $_SERVER['DOCUMENT_ROOT']."/webassist/security_assist/helper_php.php" );
// If not the login page, check permissions
if ($_SERVER['PHP_SELF'] != "/admin/index.php") {
if (!WA_Auth_RulePasses("Administrator")){
WA_Auth_RestrictAccess("/admin/index.php");
}
}



I didn't trust that paths would be adjusted in this file, and that seems to work perfectly.

Administrator is the minimum qualification and other rules determine menu items and show regions for other access, so one file allows me adjust the security of the entire admin site while using FWB.

Other uses might include arrays or session values that should be included on all pages.

It may be an unforeseen benefit, but I think the ability to template header code is a big advantage with FWB.

It seems the FWB code comes out in a variety of places in the header and sometimes is in its own code block and sometimes not, but it does seem to tend towards the bottom of the code. I would like to see it weighted to be at the top of the code for this purpose since any global code on the template tends to be code to run first.

Thanks again.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...