The following warnings occurred:
Warning [2] Undefined array key "threadviews_countguests" - Line: 745 - File: showthread.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/showthread.php 745 errorHandler->error_callback
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined property: MyLanguage::$thread_modes - Line: 46 - File: showthread.php(1650) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/showthread.php(1650) : eval()'d code 46 errorHandler->error_callback
/showthread.php 1650 eval




Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ItemManager 2.0
shrug* I'm glad to see that it's working for you now, but I didn't changed anything. Please delete the Util::dataLog() calls in /plugins/imanager/lib/CategoryProcessor.php file, and remove the log file output your postet, because everybody can see your server paths there. ;-)
Reply
(2017-04-05, 20:59:55)Bigin Wrote: shrug* I'm glad to see that it's working for you now, but I didn't changed anything. Please delete the Util::dataLog() calls in /plugins/imanager/lib/CategoryProcessor.php file, and remove the log file output your postet, because everybody can see your server paths there. ;-)

Smile))) Very strange. Smile)))))))
I still think the reason is in sessions.
Reply
Fantastic plug-in Smile

but I have problem return items between 2 date

PHP Code:
$simpleItems $itemMapper->getSimpleItems('active=1 && mydate>1504216800 && mydate<1506895140'); 
I'm try this..... but getSimpleItems() accepted only first mydate.

Please help 
Thanks
Reply
Hi angelo,

thanks.
Here was an issue when selecting "SimpleItem" objects. Therefore I recommend you to pull ItemManager from Github master repository https://github.com/bigin/ItemManager_2.0. Or just download the ZIP file from master and upgrade your installed version to the new one. Upgrading from one version of ItemManager to another is a matter of replacing these files and directories from your old version, and putting in fresh copies from the new version:

/plugins/imanager/ (complete folder)
/plugins/imanager.php (file)

For complex queries that contain multiple selectors (more than 2, there you use 3) is recommended to split them into several parts, here's an example:

PHP Code:
$activeItems $itemMapper->getSimpleItems('active=1');
$resultItems $itemMapper->getSimpleItems('mydate>1504216800 && mydate<1506895140'00$activeItems); 


Please also note the following, if you want to select SimpleItems within a specific date, including the date you have written in your selector example, then you should use ">=" and "<=" operators. So your query should then look like this:

PHP Code:
$activeItems $itemMapper->getSimpleItems('active=1');
$resultItems $itemMapper->getSimpleItems('mydate>=1504216800 && mydate<=1506895140'00$activeItems); 
Reply
(2017-09-19, 18:22:13)Bigin Wrote: Hi angelo,

thanks.
Here was an issue when selecting "SimpleItem" objects. Therefore I recommend you to pull ItemManager from Github master repository https://github.com/bigin/ItemManager_2.0. Or just download the ZIP file from master and upgrade your installed version to the new one. Upgrading from one version of ItemManager to another is a matter of replacing these files and directories from your old version, and putting in fresh copies from the new version:

/plugins/imanager/ (complete folder)
/plugins/imanager.php (file)

For complex queries that contain multiple selectors (more than 2, there you use 3) is recommended to split them into several parts, here's an example:

PHP Code:
$activeItems $itemMapper->getSimpleItems('active=1');
$resultItems $itemMapper->getSimpleItems('mydate>1504216800 && mydate<1506895140'00$activeItems); 


Please also note the following, if you want to select SimpleItems within a specific date, including the date you have written in your selector example, then you should use ">=" and "<=" operators. So your query should then look like this:

PHP Code:
$activeItems $itemMapper->getSimpleItems('active=1');
$resultItems $itemMapper->getSimpleItems('mydate>=1504216800 && mydate<=1506895140'00$activeItems); 

Wau .... thank you. worked perfect 
...but when add $start and $end parameter  getSimpleItems() not work

PHP Code:
$month 9;
$year  2017;
$start mktime(001$month1$year);
$end   mktime(235900$monthdate('t'$month), $year);

$activeItems $itemMapper->getSimpleItems('active=1');
$resultItems $itemMapper->getSimpleItems('mydate>='.$start.'&& mydate<='.$end00$activeItems);
$items       $itemMapper->filterSimpleItems('mydate''ASC','' ,'',$resultItems); 
Reply
That should work unless you have a mistake somewhere else.

I have just tested this snippet locally and it all seems to work:

PHP Code:
$date = new DateTime('2017-08-31 22:00:01');
$start $date->getTimestamp();

$date = new DateTime('2017-10-01 23:59:00');
$end $date->getTimestamp();

$activeItems $itemMapper->getSimpleItems('active=1');
$resultItems $itemMapper->getSimpleItems("mydate>=$start && mydate<=$end"00$activeItems);
$filteredItems $itemMapper->filterSimpleItems('mydate''ASC'0$resultItems);

Util::preformat($filteredItems); 
Reply
(2017-09-19, 23:31:33)Bigin Wrote: That should work unless you have a mistake somewhere else.

I have just tested this snippet locally and it all seems to work:

PHP Code:
$date = new DateTime('2017-08-31 22:00:01');
$start $date->getTimestamp();

$date = new DateTime('2017-10-01 23:59:00');
$end $date->getTimestamp();

$activeItems $itemMapper->getSimpleItems('active=1');
$resultItems $itemMapper->getSimpleItems("mydate>=$start && mydate<=$end"00$activeItems);
$filteredItems $itemMapper->filterSimpleItems('mydate''ASC'0$resultItems);

Util::preformat($filteredItems); 

I am thoroughly tested and still not worked. ItemManager v 2.4.0 from http://get-simple.info/

$activeItems -> return all items when active=1 
$resultItems -> return all items between 2 dates but ignore $activeItems, (return all active=1 and active=0 items)
$filteredItems -> worked fine 

but I try ItemManager v 2.4.0 from https://github.com/bigin/ItemManager_2.0
All worked fine Smile))

Please compare this version.

Thanks
Reply
Yes, as I mentioned before, the version from "extend" has an issue when rekursive selectig SimpleItem objects. This will be updated soon
Reply
Here's an alpha version of ItemManager-3 for curious and open-minded people:
https://gitlab.com/bigin1/imanager

Please don't try to use temManager-3-alpha above the IM 2.* , it won't work.
Reply
Hey Bigin, i just found your plugin and i'm sure it's the one i've been looking for a long time Wink

Can you please help my to get the following idea working:

PHP Code:
<?php
  $manager 
= new IManager();
 
 $categoryClass $manager->getCategoryClass();
 
 $itemClass $manager->getItemClass();

 
 $category $categoryClass->getCategory(1);
 
 $itemClass->init($category->get('id'));
 
 $items $itemClass->getItems(1'active=1');

 
 foreach($items as $item) {
 
   $image      $item->fields->profilbild->imagefullurl[1];
 
   $name       $item->fields->name->value;
 
   $instrument $item->fields->instrument->value;
 
 };
?>


Thanks a lot for your work!!
Reply
Hello Fabmue,

hmm, hard to say, I don't really know what your idea is, it depends on what you want to do with your item data, whether you want to display it or process it further, and so on. If you just want to display them, better do it with "SimpleItem" objects, it's easy:

PHP Code:
$imanager imanager();
$mapper $imanager->getItemMapper();
// change 5 to your category id
$mapper->alloc(5);
foreach(
$mapper->simpleItems as $item) {
    echo 
'<img src="'.$item->profilbild[0].'">';
    echo 
"<h3>$item->name</h3>";
    echo 
"<p>$item->instrument</p>";

Reply
(2018-02-13, 17:10:09)Bigin Wrote: Hello Fabmue,

hmm, hard to say, I don't really know what your idea is, it depends on what you want to do with your item data, whether you want to display it or process it further, and so on. If you just want to display them, better do it with "SimpleItem" objects, it's easy:

PHP Code:
$imanager imanager();
$mapper $imanager->getItemMapper();
// change 5 to your category id
$mapper->alloc(5);
foreach(
$mapper->simpleItems as $item) {
 echo 
'<img src="'.$item->profilbild[0].'">';
 echo 
"<h3>$item->name</h3>";
 echo 
"<p>$item->instrument</p>";


It works perfectly!! Thank you so much Smile
Reply
One more question: when I use
PHP Code:
.$item->profilbild[0]. 
I get www.mydomain.com/PATH-TO-IMG. But if I'm not on the index page, it dosn't work, because the link is now www.mydomain.com/PAGENAME/PATH-TO-IMG.

Is there a chance to get the absolute img path? I think that would fix the problem.

Thanks!
Reply
Use constant:
PHP Code:
echo '<img src="'.IM_SITE_URL.$item->profilbild[0].'">'
;-)
Reply
(2018-02-14, 05:11:45)Bigin Wrote: Use constant:
PHP Code:
echo '<img src="'.IM_SITE_URL.$item->profilbild[0].'">'
;-)

brilliant!
Reply
Questions
1. How  setup datepicker first date on Monday?

2. I have 3 field example    
1 - Name -> Text field
2 - Date -> datepicker 
3 - Time -> Text field

How save DATE + TIME in one field ? (2018-12-30 09:45:00)

I need filter data for Datetime not only date.

Thanks
Reply
Oh, dear, I love these kind of questions ;-P

I believe that jQuery UI datepicker does not support time by default.

So you have two options here, you could either build a custom datetime field or you can choose a quick-and-dirty solution.

If you decide to build a new datetime field, you can copy, rename and modify the following files according to your wishes:
  1. /plugins/imanager/lib/processors/inputs/InputDatepicker.php
  2. /plugins/imanager/lib/processors/fields/FieldDatepicker.php



You also need to adjust a backend template file: "/plugins/imanager/tpl/row.fields.im.tpl"
Here you can find more information and an example: https://ehret-studio.com/lab/itemmanager...ieldtypes/

Let me try the other quick-and-dirty option. I'll be back in a minute...
Reply
Okay, here's the quick-and-dirty solution - it's a little more complicated than I thought, so let's just call it 'dirty-solution':

1. Create a new field in your category. Name it 'datetime', for example. NOTE, please choose a normal 'text field' as field type for it.

2. Create another field in your category. Name it how you like, 'datetimejs' for example. Choose type 'chunk' for it.

3. Now, download Datepicker UI addon (2 files javascript and css) from: http://trentrichardson.com/examples/timepicker/
I placed my files here for testing: /theme/Cardinal/timepicker/jquery-ui-timepicker-addon.js/*.css

4. Next you need to add the loaded css/js files to your admin. The best way to do this is to write a simple plugin for it:


PHP Code:
register_plugin(
    
basename(__FILE__'.php'),
    
'ResLoader',
    
'1.0',
    
'Your Name',
    
'https://your-site.com',
    
'A GS plugin to load resources into the header',
    
'',
    
''
);

register_style('timepicker-addon-css',
    
$SITEURL.'theme/Cardinal/timepicker/jquery-ui-timepicker-addon.css'GSVERSION'screen');
register_script('timepicker-addon-js',
    
$SITEURL.'theme/Cardinal/timepicker/jquery-ui-timepicker-addon.js'GSVERSIONtrue);
queue_style('timepicker-addon-css'GSBACK);
queue_script('timepicker-addon-js'GSBACK); 

5. Activate the plugin and check if the resources have been loaded in admin.

6. Now go to the 'fields' menu, select 'datetimejs' (chunk) field and click 'Edit Field'.
Now add this JavaScript code as default value:
Code:


<script>
$(function() {
         // DateTimePicker
        $('#datetime').datetimepicker({
            dateFormat: 'yy-mm-dd',
            changeMonth: true,
            changeYear: true,
            timeFormat: 'HH:mm',
            showSecond: false,
            separator: ' ',
            firstDay: 1
        });
        /*mete avisos al log, en distro no debería*/ (function(factory) { if (typeof define === "function" && define.amd) { define(["jquery", "jquery-ui-dist"], factory); } else { factory(jQuery); } }(function( $ ){ $.timepicker.log=function(){return} }));
});
</script>



... and click the save button. Note, that you may need to rename selector $('#datetime') depending on the name of your datetime field.

Well, that's it, now you can save and compare datetime:

PHP Code:
$catId 4;
$imanager imanager();
$mapper $imanager->getItemMapper();
$mapper->alloc($catId);
$items $mapper->getSimpleItems("datetime>2018-06-26 13:47");

var_dump($items); 
Reply
I did some tests now and found this library: https://xdsoft.net/jqplugins/datetimepicker/
On GH: https://github.com/xdan/datetimepicker

This seems to be better solved than the one I suggested before. I have tested it with these settings and it all worked without errors:

Code:
<script>
$(function() {
   $.datetimepicker.setLocale('de');
   // DateTimePicker
   $('#datetime').datetimepicker({
       i18n:{
           de:{months:[
               'Januar','Februar','März','April',
               'Mai','Juni','Juli','August',
               'September','Oktober','November','Dezember',
              ],
              dayOfWeek:[
              "So.", "Mo", "Di", "Mi",
               "Do", "Fr", "Sa.",
            ]}
       },
       dayOfWeekStart: 1, // Monday
       timepicker: true,
       format:'Y-m-d H:i',
       step: 5
   });
});
</script>

I hope this helps
Reply
(2018-06-27, 15:57:14)Bigin Wrote: I did some tests now and found this library: https://xdsoft.net/jqplugins/datetimepicker/
On GH: https://github.com/xdan/datetimepicker

This seems to be better solved than the one I suggested before. I have tested it with these settings and it all worked without errors:

Code:
<script>
$(function() {
   $.datetimepicker.setLocale('de');
   // DateTimePicker
   $('#datetime').datetimepicker({
       i18n:{
           de:{months:[
               'Januar','Februar','März','April',
               'Mai','Juni','Juli','August',
               'September','Oktober','November','Dezember',
              ],
              dayOfWeek:[
              "So.", "Mo", "Di", "Mi",
               "Do", "Fr", "Sa.",
            ]}
       },
       dayOfWeekStart: 1, // Monday
       timepicker: true,
       format:'Y-m-d H:i',
       step: 5
   });
});
</script>

I hope this helps


Nice solution. Smile

My solution.... add 2 new fields

1 - name -> Text field
2 - date -> datepicker 
3 - time -> Text field
4 - datetime ->text field
5 - datetimeJS ->chunk field

JS for datetimeJS
Code:
<script>
jQuery(document).ready(function () {
  $( "#time, #dpdate" ).change(function() {
     var date = $("#dpdate").val() + ' ' + $("#time").val() + ':00';  
     $( "#datetime").val(date);
  });
});
</script>

When add date and time -> JSscript merge date and time -> add to datetime field
But... your solution ist better :Smile

Thank you. Love your works.

Sorry  but I'm .....
100% designer
90% html/css
60% php/js coder 
Blush
Reply
Cool, that's right, it works that way too ;-)

Just an idea: You could also define your "#datetime" field as "hidden" instead of "text", so this is hidden in admin.
Reply
This is the answer to the question from this thread: http://get-simple.info/forums/showthread.php?tid=10580&pid=62939#pid62939

Don't quite understand what you want, is it an ImForms form you want to show or are you looking for a way to create the items from the frontend?
Reply
(2018-09-03, 00:08:46)Bigin Wrote: This is the answer to the question from this thread: http://get-simple.info/forums/showthread.php?tid=10580&pid=62939#pid62939

Don't quite understand what you want, is it an ImForms form you want to show or are you looking for a way to create the items from the frontend?

Yes, I want to create items from the front-end without having to login and allow anon users to submit item(s).

I just read the docs and seems like it wouldn't be too hard to create a form but of course it would be optimal use already built-in solutions.
Reply
If your items do not contain complex fields like the 'file upload' etc, I recommend that you create your own form. Creating a simple custom form is quite faster than using the API to render markup:

Code:
<p><?php echo $msg ?></p>
<form action="./" method="post" ...>
    <input type="text" name="title"><br>
    <textarea name="content"></textarea><br>
    ...
    <input type="hidden" name="action" value="save-item">
    <button type="submit">Save</button>
</form>

Now you can process and save the data after sending the form. You say you already have ImForms in use, so you can just get the user input directly from the input variable `$imforms->input->post->field_name`, instead of the using PHP superglobal $_POST, for example:

PHP Code:
$msg '';
if(
$imforms->input->post->action == 'save-item') {
    if(
saveItem($imforms$msg)) {
        
Util::redirect('./');
    }
}
function 
saveItem($imforms, & $msg) {
    
$input $imforms->input;
    
$imanager imanager();

    
// validate/sanitize user input
    
$input->whitelist->title $imanager->sanitizer->text($input->post->title);
    if(!
$input->whitelist->title) {
        
$msg 'Error: Title field empty ...';
        return 
false;
    }

    
$input->whitelist->content $imanager->sanitizer->textarea($input->post->content);
    if(!
$input->whitelist->content) {
        
$msg 'Error: Enter a content ...';
        return 
false;
    }

    
// Create new item (just change the category id)
    
$category_id 5;
    
$newItem = new Item($category_id);

    
$newItem->name $input->whitelist->title;
    
$newItem->setFieldValue('content'$input->whitelist->content);
    
$newItem->active true;

    if(
$newItem->save()) { return true; }

    return 
false;


Ps. The code above should be placed somewhere at the top of your template file before the output is done.
More information about using ItemManager can be found on the website: https://ehret-studio.com/articles/itemmanager/
Reply
(2018-09-03, 00:08:46)Bigin Wrote: This is the answer to the question from this thread: http://get-simple.info/forums/showthread.php?tid=10580&pid=62939#pid62939

Don't quite understand what you want, is it an ImForms form you want to show or are you looking for a way to create the items from the frontend?

(2018-09-03, 03:20:56)Bigin Wrote: If your items do not contain complex fields like the 'file upload' etc, I recommend that you create your own form. Creating a simple custom form is quite faster than using the API to render markup:

Code:
<p><?php echo $msg ?></p>
<form action="./" method="post" ...>
    <input type="text" name="title"><br>
    <textarea name="content"></textarea><br>
    ...
    <input type="hidden" name="action" value="save-item">
    <button type="submit">Save</button>
</form>

Now you can process and save the data after sending the form. You say you already have ImForms in use, so you can just get the user input directly from the input variable `$imforms->input->post->field_name`, instead of the using PHP superglobal $_POST, for example:

PHP Code:
$msg '';
if(
$imforms->input->post->action == 'save-item') {
    if(
saveItem($imforms$msg)) {
        
Util::redirect('./');
    }
}
function 
saveItem($imforms, & $msg) {
    
$input $imforms->input;
    
$imanager imanager();

    
// validate/sanitize user input
    
$input->whitelist->title $imanager->sanitizer->text($input->post->title);
    if(!
$input->whitelist->title) {
        
$msg 'Error: Title field empty ...';
        return 
false;
    }

    
$input->whitelist->content $imanager->sanitizer->textarea($input->post->content);
    if(!
$input->whitelist->content) {
        
$msg 'Error: Enter a content ...';
        return 
false;
    }

    
// Create new item (just change the category id)
    
$category_id 5;
    
$newItem = new Item($category_id);

    
$newItem->name $input->whitelist->title;
    
$newItem->setFieldValue('content'$input->whitelist->content);
    
$newItem->active true;

    if(
$newItem->save()) { return true; }

    return 
false;


Ps. The code above should be placed somewhere at the top of your template file before the output is done.
More information about using ItemManager can be found on the website: https://ehret-studio.com/articles/itemmanager/

Great, thanks! But actually I do have upload/image field on the form...
Reply




Users browsing this thread: 1 Guest(s)