General developer forum

 
 
Picture of stephane ng
Explain me a Layout Moodle2
 

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: -
It's only an avatar...
Re: Explain me a Layout Moodle2
Group DevelopersGroup Documentation writersGroup Particularly helpful MoodlersGroup Testers

 
Average of ratings: -
Picture of Sami Hwang
Re: Explain me a Layout Moodle2
 

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.

 
Average of ratings: -
Picture of stephane ng
Re: Explain me a Layout Moodle2
 

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

 

 

 

 

 

 
Average of ratings: -
Picture of stephane ng
Re: Explain me a Layout Moodle2
 

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 ?

 

 

 
Average of ratings: -
Andrew Normore
Re: Explain me a Layout Moodle2
 

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!

 
Average of ratings: -