Module Edit View

edited May 2011 in News & Announcements
Could someone please help me. I'v read the user guide and all the Forum discussions - and now I'm really confused.
I can't get anything to work.
What I want to do is display/edit data from a module in the web side of the site - not in admin.
So according to the manual, I must put the following code in a Page.

{fuel:module:articles var="my_articles" find="all"}


When I try to view this page I get the following error:
An Error Was Encountered
Compilation error at line 75 in "string:" : Parse error in "fuel:module:articles var="my_articles" find="all"} {my_articles} {article.title} {/my_articles}

Any help would be appreciated.


  • edited 3:31PM
    If it is a page editable in the admin, then you can use the Dwoo templating syntax:
    {$articles = fuel_model('articles')} ?> {foreach($articles article)} {$article->title} {/foreach}

    If it is just a normal view file then you can use normal php syntax like so:
    <?php $articles = fuel_model('articles'); ?> <?php foreach($articles as $article) : ?> <?php echo $article->title; ?> <?php endforeach; ?>

    What I normally do is create the static view file and then import into the CMS which will take care of most, if not all the templating syntax conversion.

    Where did you see that templating syntax mentioned above?
  • edited May 2011
    I forgot to mention, that if you want to edit from site, you can use the fuel_edit() function:
    {$articles = fuel_model('articles')} ?> {foreach($articles article)} {fuel_edit($article->id, 'Edit Article', 'articles')} {$article->title} {/foreach} (fuel_edit and fuel_var functions in particular)
  • edited 3:31PM
    Thanks, that's real simple !

    As to where I got the example code above, it was -
    Users Guide Home > Modules > Simple modules > The Views > Form View.

    I have another question ;
    Is there a way of inserting new records into the module from the site as apposed to Admin ?
  • edited 3:31PM
    For inserting new records, you can use 'create' instead of the $article->id for the first parameter.

    I'll update that graphic to show the use of the dwoo syntax (that was a screenshot of a test page we used for an older templating syntax.
  • edited 3:31PM
    Either I'm missing something or your code is missing something as it does not allow editing as it is :

    {$articles = fuel_model('articles')} ?>
    {foreach($articles article)}
    {fuel_edit($article->id, 'Edit Article', 'articles')}

    I therefore can't try the 'create' ? I have tried to find examples in the User Guide, following the links you sent me, but to no avail.

  • edited 3:31PM
    Sorry ! My bad - I forgot to click on the 'pencil' to put the page into edit mode .
  • edited June 2011
    Related question -- I'm making my first attempt at a page that is editable from the site (not admin). I am logged in as super-admin and I do successfully edit this table from the admin. I also know (is_fuelified()) is true when I test it from the web page where I'm trying to put the edits.

    I just tried

    <?php $hotspots = fuel_model('hotspots'); ?>
    foreach($hotspots as $hotspot):
    <?=fuel_edit($hotspot->id, 'Edit Hotspot', 'hotspots');?>
    <?=$hotspot->hotspot ?>
    <?php endforeach; ?>

    I see the obviously echoed data and the generated html shows several spans related to editing just after the body tag and a span with class="__fuel_marker__" that looks completely logical for each item I want to edit

    However ---
    I never see the fuel edit icon !

    Any thoughts on what I might be doing wrong?

    Thanks in advance ...
  • edited 3:31PM
    Is this not working?
  • edited 3:31PM
    No -- I never see the edit control bar (as in the little bar on the upper right of the item to be edited that would have the pencil icon)-- all the generated code looked logical, but obviously something must be missing.

  • edited 3:31PM
    I think it has to be some form of configuration or permissions issue ... I changed to use Dwoo and the problem did not go away ...

    I also added the name of the module explicitly as a permission (even though I'm currently testing as super admin) ... the problem did not go away
  • edited 3:31PM
    For the pencil icons to show up, you need to be logged in to FUEL and then viewing your website. There should be a little FUEL icon in the upper right and when you click it, it will slide open and should have a pencil icon that when clicked, will display the editable areas. If you are still having issues, try logging out and then logging back in to FUEL and then viewing the page you want to do inline editing on. Let me know if that helps at all.
  • edited 3:31PM
    Been there, done that. Did it again.

    Does not help.

  • edited 3:31PM
    Are there perhaps any PHP or javascript errors on the page that is preventing the javascript to execute for that top menu? You got a testing environment I can have access too? You can email me with the info if you want me to look at it.
  • edited 3:31PM
    I moved all edits into their own space and put them in "dwoo". This is a development environment. I'll happily provide info. I'll e-mail. Many thanks.
Sign In or Register to comment.