TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 08-24-2008, 08:01 AM   #1 (permalink)
The Wanderer
 
Join Date: Jun 2008
Posts: 19
Thanks: 0
oscargodson is on a distinguished road
Help Building Template and Stuck... Help?

I'll try to explain this as best as I can, but what I am trying to do isn't exactly easy to explain

I have a base XML file (plugins.xml) In this file I have a root <plugins> node. Inside of that are <plugin> nodes. I have a form (deploy_form.php) which uses this XML sheet. To make it easy for people to add plugins to this application they can add some basic nodes to this xml sheet and the form will create a new checkbox option on the deploy_form.php file. Here is what code I have for the form:

PHP Code:
            <?php
                
foreach($pluginData->plugin as $plugin){
                    
$name $plugin->name;
                    echo 
'
                    <li><input type="checkbox" value="'
.$name.'_plugin" name="jquery_plugin_'.$name.'" />'.$name.'</li>
                    '
;
                }
            
?>
My trouble however is on the next page after the user submits this form.

I need to create a new script tag for each new plugin they add. These are jQuery plugins and so they need to make new script tags one after another in a new html/php page. My application creates (among many other things) an index html or php file with default settings such as CSS, image directories, js, jQuery library etc. Here is some more PHP code:
PHP Code:
$html_temp ''.$html_doctype.'

<html '
.$html_attr.'>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>'
.$html_title.'</title>
    '
.$css.'
    '
.$jquery.'
    
</head>

<body>
    
</body>
</html>
'

I use that variable in an fwrite function below. I need to do a foreach statement like this and put it after where I have the $jquery var

PHP Code:
foreach($pluginData->plugin as $plugin){
    
$name $plugin->name;
    
$filename $plugin->name['filename'];
    
$dir $plugin->dir;
    
$css $plugin->css;
    
$images $plugin->images;

    if(isset(
$_GET["jquery_plugin_$name"])){
        
exec("cp -r files/JavaScript/jQuery/plugins/$dir/$filename $deploy_download/js/$filename");
        if(isset(
$css)){

        }
        if(isset(
$images)){

        }
    }
    echo 
'<script type="text/javascript" src="js/'.$filename.'"></script>';

I took out a lot of code so it makes it easier for you guys to help so there is a lot more options going into this but I need that final echo below to be repeated for every checked checkbox the user checked for their plugin choice. So, for example, lets say they choose 2 of 3 plugins. Then there would be a total of 2 <script> tags underneath the $jquery variable that needs to be written to a final .html or .php template.
oscargodson is offline  
Reply With Quote
 



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 09:08 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design