News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

view calander post from another page

Started by glennmckenna, October 29, 2016, 05:37:37 AM

Previous topic - Next topic

glennmckenna

hi,

i'm currently trying to include the calendar event creation forme in another page (that i've created and that does not use SSI.php)
here is a link to the page :
http://beta.mdl-palissy.fr/forum/index.php?action=genevent

i've trying to follow this tuto but it looks like i'll have to modify the calendar.php file, something that i don't exactly want to do due to the smf updates

http://stackoverflow.com/questions/8104998/how-can-call-function-of-one-php-file-from-another-php-file-and-pass-parameter-t

i also found some stuff about .load() but i'm not sure on how to use it

here is the code to the template page
<?php
function template_main() {
    global 
$boardurl$context$settings$options$txt$scripturl$modSettings$sourcedir;



    
$g_gen allowedTo('genevent');


    if (
$g_gen) {
        echo 
'
        <script src="../../../scripts/jquery-1.12.0.min.js"></script>
        <script src="'
$boardurl'/Themes/Redsy/scripts/mform.js"></script>

            <div class="col-md-12 col-xs-12 form-box">
                
                <form role="form" action="" method="post" class="registration-form">
                    
                    <fieldset>
                        <div class="form-top">
                            <div class="form-top-left">
                                <h3>Step 1 / 4</h3>
                                <p>Tell us who you are:</p>
                            </div>
                        </div>
                        <div>
                            123
                        </div>
                        <div class="form-bottom">
                            <button type="button" class="btn btn-next">Next</button>
                        </div>
                    </fieldset>
                    
                    <fieldset>
                        <div class="form-top">
                            <div class="form-top-left">
                                <h3>Step 2 / 4</h3>
                                <p>Set up your account:</p>
                            </div>
                        </div>
                        <div>
                            456
                        </div>
                        <div class="form-bottom">
                            <button type="button" class="btn btn-previous">Previous</button>
                            <button type="button" class="btn btn-next">Next</button>
                        </div>
                    </fieldset>
                    
                   <fieldset>
                        <div class="form-top">
                            <div class="form-top-left">
                                <h3>Step 3 / 4</h3>
                                <p>Set up your account:</p>
                            </div>
                        </div>
                        <div>
                            789
                        </div>
                        <div class="form-bottom">
                            <button type="button" class="btn btn-previous">Previous</button>
                            <button type="button" class="btn btn-next">Next</button>
                        </div>
                    </fieldset>
                    
                    <fieldset>
                        <div class="form-top">
                            <div class="form-top-left">
                                <h3>Step 4 / 4</h3>
                                <p>Social media profiles:</p>
                            </div>
                        </div>
                        <div>
                            159
                        </div>
                        <div class="form-bottom">
                            <button type="button" class="btn btn-previous">Previous</button>
                           <div class="btn">Sign me up!</div>
                        </div>
                    </fieldset>
                
                </form>
                
            </div>



        '
;
    }elseif (
file_exists(dirname(dirname(__FILE__)) . '/Settings.php'))
    {
        
// Found it!
        
require(dirname(dirname(__FILE__)) . '/Settings.php');
        
header('Location: ' $boardurl);
    }
// Can't find it... just forget it.
    
else
        exit;
}

?>


and here is the code to the page that while call the template
<?php
/**
 * Created by PhpStorm.
 * User: glenn
 * Date: 19/08/2016
 * Time: 16:33
 */
// Check for any suspicious activity
if (!defined('SMF'))
    die(
'Hacking attempt...');

// Make sure this corresponds to what was in the array from previously!
function genevent() {

    global 
$context$scripturl;

    
loadTemplate('genevent'); // Load the genevent.template.php file
    
$context['page_title'] = $context['forum_name'] . ' - genevent'// Page title

    
Displaygenevent();
};

// This will display the main page
function Displaygenevent() {
    global 
$context;
}

?>


so my question is :
is there a were to include the event creation form by using variables without modifying the calander.php or the calander.template.php?

if i can't do this can i modify those pages in a way that the modification won't affect the smf updates or that the modifications won't be affectd by the smf updates ?

glennmckenna

this is a bit of a random guess but could i possibly use hooks ?

if yes what hooks could i use ?
and how would i go about to using them ?

Kindred

why are you refusing to use SSI? This is exactly what SSI is designed for...


Hooks are designed to trigger events within the SMF flow not for pages outside of SMF.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

glennmckenna

Quote from: Kindred on October 29, 2016, 06:46:08 AM
why are you refusing to use SSI? This is exactly what SSI is designed for...


Hooks are designed to trigger events within the SMF flow not for pages outside of SMF.
cause when i started creating this page i thought that it wasn't possible to verify permissions
cause i've permission just for this pages

so what would be my best option ?
cause to add i'm sure if and how i can verify the permisions with SSI

Kindred

You can use standard SMF permissions with SSI...
you can also include standard SMF Sources files into a script that has already called SSI.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

glennmckenna

Quote from: Kindred on October 29, 2016, 07:09:57 PM
You can use standard SMF permissions with SSI...
you can also include standard SMF Sources files into a script that has already called SSI.
so in other words with the pages that i've created currently i can call SSI and then get the parts of the pages that i need ?

Kindred

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

glennmckenna

Quote from: Kindred on October 30, 2016, 10:07:24 AM
essentially
correct if i'm wrong but all i need to do is just include SSI.php in the templat file ?

i guess that it will be easier using the SSSi rather than using variables to directly go and fetch what i'm after ?

oh one other thing though i also need to include the upload image part of smf gallery but i guess that there isn't anything for that in the SSI so how could i do that ?

Kindred

No...

Including ssi allows you to include sources files and call smf functions... 
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

glennmckenna

Quote from: Kindred on October 30, 2016, 11:05:58 AM
No...

Including ssi allows you to include sources files and call smf functions...
i'm a bit lost now

is this correct:
what i've to do is call directly the functions in the source files wich will the call the template
basiclly copying and pasteing certain lines from the SSI

and the for smf gallery it's kind of the same thing but i can't reuse lines from the SSI due to t not being intergrated to the SSI

Kindred

No...   the sources files do not call the templates...

And no, you do t copy lines from ssi...

You include ssi.php and then can include additional sources files as needed and call smf functions from those files.  But you still have to parse the output into HTML, otherwise why not just use the smf page....
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

glennmckenna

Quote from: Kindred on October 30, 2016, 11:54:07 AM
No...   the sources files do not call the templates...

And no, you do t copy lines from ssi...

You include ssi.php and then can include additional sources files as needed and call smf functions from those files.  But you still have to parse the output into HTML, otherwise why not just use the smf page....
i would like to use the smf page but i don't want the header nore the footer, weather it's the event creation page for the calandar or the image ploade page for smf gallery

glennmckenna

right i've taken another look into this it seems i miss understood the first time

so my question now is
i include SSI.php in the template page then i call the event creation page ?

but how would i call the event creation page, cause i can only view with the SSI.php ?

Advertisement: