Tutorial Issues Using Elgg 2.2.3

I am renewing my programming skills (stopped after obtaining minor in 2002) to build a website.  I feel like there has been an explosion in internet coding so I am brushing up my skills.

I have been trying to do the tutorials (on this site and youtube); however, I am not able to do some of the elementary samples.  When I perform them, doing exactly what is told (copying files provided in the directories given), I do not get a correct response.  I feel like this might be due to the Elgg version that I am using vs. what is in the tutorials.  Does that make sense?  

Specifically, for example, in the "My_Blog" tutorial, after setting up the form, when I go to view it on my site, the view of my site's body is the entire code text from the "save.php" file in myblog/views/default/forms/my_blog.  Here is what the 'body' looks like:

Create a new my_blog post

echo elgg_view_field([ '#type' => 'text', '#label' => elgg_echo('title'), 'name' => 'title', 'required' => true, ]); echo elgg_view_field([ '#type' => 'longtext', '#label' => elgg_echo('body'), 'name' => 'body', 'required' => true, ]); echo elgg_view_field([ '#type' => 'tags', '#label' => elgg_echo('tags'), '#help' => elgg_echo('tags:help'), 'name' => 'tags', ]); $submit = elgg_view_field(array( '#type' => 'submit', '#class' => 'elgg-foot', 'value' => elgg_echo('save'), )); elgg_set_form_footer($submit);

I am also watching a youtube video on customizing Elgg, and it seems like the person is using a different Elgg with a completely different software tree.  So, for example, when he rewrites a "header_logo.php" in his mod/example_plugin/views/default/page/elements directory, the changes show up in his main website's header.  However, when I try to do the same, it does nothing.  I noticed that the version I am using only has 3 folders in its top level directory:  elgg_config, mod, and vendor.  All view files seem to be in a directory in the vendor folder.  

I tried making folders in my plugin folder (vendor/elgg/elgg/views/default/page/elements), but that does not work either.  I also tried placing the entire plugin under vendor/elgg/elgg/mod, but that does not work either.

Please help.

Thank you.

 

 

 

  • This might seem like a silly question but did you activate your custom plugin in the admin > plugin page?

  • Don't touch /vendor folder.

    Create your plugin in /mod folder, e.g.:

    /mod/your_plugin_name

    Now create your start.php, actions, pages, view(-s), forms

  • Yes, I activated the plugin.  

    I created everything in /mod folder.  I was thinking maybe there has been a major structural tree change in the Elgg software without updating the tutorials?  I am just not sure if the folders under /mod can inherit from folders in /vendor with the way the folders are structured with Elgg 2.2.3.  Can they?

  • You only have to upload your custom plugin into the root/mod directory.

  • I noticed that there is a different tutorial for elgg 2.0.  I am using 2.2.3.  

    I tried the tutorial for 2.0 and it works perfectly.  I substituted the /action/my_blog/save.php files and now the 2.2.3 tutorial works!

    I think I know the problem, I just don't know why.  when we pass the "actions/my_blog/save.php" file containing the <div> tags to the elgg_view_form() in the resources/my_blog/add.php, the script works fine.  The problem starts when we replace the <div> tags with: 

    echo elgg_view_field([
        '#type' => 'text',
        '#label' => elgg_echo('title'),
        'name' => 'title',
        'required' => true,
    ]);

    For some reason, the  elgg_view_form() simply returns the above code as a string and spits it out to the webpage.  

    I ran multiple tests, and I believe that the function elgg_view_field() is not identified.  Does this make sense? 

Beginning Developers

Beginning Developers

This space is for newcomers, who wish to build a new plugin or to customize an existing one to their liking