Explain me a Layout Moodle2

Explain me a Layout Moodle2

by stephane ngov -
Number of replies: 5

Hi, I a new post for trainning know the template Moodle.

I try create new block "Hello", this is the picture

 

Now I think I know how create a block in moodle, Now I want learn how I write in

moodle center

this is a picture for exemple what I want do

 

 

Imagine, After cliquer to link "statistique", I want in a center

keep header,footer and blocks.

How i must write in the file ?

Show me one script example how i can build this center ?

 

Average of ratings: -
In reply to stephane ngov

Re: Explain me a Layout Moodle2

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers
In reply to Mary Evans

Re: Explain me a Layout Moodle2

by Sami Hwang -

Hello Mary,

So glad to see the familiar name here.

Let's sau if I want to add the form type of content such as search box etc...not static content, dynamic content, how can we do that?

Is it possible? The example illustratio is in the below.

In reply to Sami Hwang

Re: Explain me a Layout Moodle2

by stephane ngov -

Thinks for reply but , I know how create activities,

My question is for developpeur , I want creat my own script php.

In de document is explan how i can build block , but now I didn't how

i must do for the center page moodle.

for example:

I want  know all  email

I will guess this is script

 

moodle/allemail/index.php

echo $OUTPUT->header(); //call header

echo $OUTPUT->block(); /:call block

//request all email in table mdl_user my script

echo $OUTPUT->footer(); //call footer

 

 

 

 

 

In reply to stephane ngov

Re: Explain me a Layout Moodle2

by stephane ngov -

I try this example doc

 

<?php
require('../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->dirroot.'/course/lib.php');
echo $OUTPUT->doctype() ;
?>

<html <?php echo $OUTPUT->htmlattributes() ?>>
<head>
<title><?php echo $PAGE->title ?></title>
<?php echo $OUTPUT->standard_head_html() ?>
</head>
<body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses) ?>">
<?php echo $OUTPUT->standard_top_of_body_html() ?>
<table id="page">
<tr>
<td colspan="3">
<h1 class="headermain"><?php echo $PAGE->heading ?></h1>
<div class="headermenu"><?php echo $OUTPUT->login_info(); echo $PAGE->headingmenu; ?></div>
</td>
</tr>
<tr>
<td>
<?php echo $OUTPUT->blocks_for_region('side-pre') ?>
</td>
<td>
<?php echo core_renderer::MAIN_CONTENT_TOKEN ?>
</td>
<td>
<?php echo $OUTPUT->blocks_for_region('side-post') ?>
</td>
</tr>
<tr>
<td colspan="3">
<p class="helplink"><?php echo page_doc_link(get_string('moodledocslink')) ?></p>
<?php
echo $OUTPUT->login_info();
echo $OUTPUT->home_link();
echo $OUTPUT->standard_footer_html();
?>
</td>
</tr>
</table>
<?php echo $OUTPUT->standard_end_of_body_html() ?>
</body>
</html>

I was error,

block_manager has not yet loaded the blocks, to it is too soon to request the information you asked for.

 

how i can load block_mananger ?

 

 

In reply to stephane ngov

Re: Explain me a Layout Moodle2

by Andrew Normore -

Hey Sami, I totally understand the difficulty you're having!

In Moodle 1.9 you could easily add blocks to the center. Apparently Moodle 2.x CAN do this, I've figured out the 'Theory' to do it. You need to create a theme, that hast POST and PRE sides, which are standard. Then you need to add TOP and BOTTOM, perhaps MID block regions. 

Might I suggest you use a FILTER?

You would create a label activity, with contents myplugin

The filter would then execute your display_my_plugin() function.

 

You will want to create a local plugin (/local/mynewplugin/index.php and lib.php)

display_my_function() is inside of lib.php!