Problems, need help? Have a tip or advice? Post it here.
70 posts Page 2 of 7
Previous 1, 2, 3, 4, 5 ... 7 Next
I would beleve so, but did try but with failure.

So if you have any idea of how the code would be i would be very happy :)
kimheggen wrote: I would beleve so, but did try but with failure.

So if you have any idea of how the code would be i would be very happy :)


If you just wish to display this in a template on the admin panel, you could *try* this - completely untested and unsure if this will work.

Code: Select all
<cms:editable type='message' name='show_count'>
    <cms:set incr_count='0' />

    <cms:pages template='users/nytt-fraver.php'>
        <cms:incr incr_count lenght />
    </cms:pages>

    <div class="count"><cms:show incr_count /></div>
</cms:editable>
Image
Bartonsweb wrote:
kimheggen wrote: I would beleve so, but did try but with failure.

So if you have any idea of how the code would be i would be very happy :)


If you just wish to display this in a template on the admin panel, you could *try* this - completely untested and unsure if this will work.

Code: Select all
<cms:editable type='message' name='show_count'>
    <cms:set incr_count='0' />

    <cms:pages template='users/nytt-fraver.php'>
        <cms:incr incr_count lenght />
    </cms:pages>

    <div class="count"><cms:show incr_count /></div>
</cms:editable>


Thanks for reply BartonsWeb, but this code result in BLANK.
Hi BartonsWeb!

I did some changes to the CODE and now its working perfeck :)

It begins to get fun now when im starting to understand all and can manage to solve issues and make thing work, but off course with GOOD HELP from the people here.

Here is my code: Removed the EDITABLE and change TEMPLATE to MASTERPAGE

Code: Select all
    <cms:set incr_count='0' />

    <cms:pages masterpage='users/nytt-fraver.php'>
        <cms:incr incr_count varighet />
    </cms:pages>

    <div class="count"><cms:show incr_count /></div>
Oops on the template instead of masterpage. My apologies, I had just woken!

As for removing editable, I assumed you wanted to output it to teh admin panel (as in couches admin panel) not a custom one. Of course outputting to front-end would work without the editable tags. Glad it works :)
Image
I made a TODO list and it works like a sharm.

In the front End i wanna have to buttons - Unpublish and Delete (delete is working)

But im having problem with how to work out the code so the button - unpublish when get clicked!

Any ideas how to to this!
After alot of time on the forum and couch documentations i must ask for help!

I have made a page where my employees can fill out a form to register what they drive every day from home to work etc. But im having some problem!

So i have a page 'kjorebok.php' and on this page i have the form and listing/view thogether as shown on picture. I have several users.

All works but im at the point where i need to implement FOLDERs i think.

Kjorebok.php has dynamic_folders set to '1' and i have made a parent folder '2016' and some child folders 'jan' 'feb' 'mar' etc. When a user login and go to kjorebok.php and fill out the form i have a field MÅNED that is a dropdown and show the child folders.

But when saving the form the data gets saved to main page kjorebok.php and not to the selected folder.

My code is:

Code: Select all
<?php require_once( '../admin/cms.php' ); include 'header.php'; ?>

<cms:set id="<cms:gpc 'id' method='get' />" scope='global' />

<cms:template title='Kjørebok' clonable='1' hidden='0' order='13' access_level='1' dynamic_folders='1'>

    <cms:editable name='date' type='text' />
    <cms:editable name='from' type='text' />
    <cms:editable name='to' type='text' />
    <cms:editable name='why' type='text' />
    <cms:editable name='km' type='text' />
    <cms:editable         
        name='pass'
        required='0'
        type='dropdown'
        opt_values=' Passasjer=- | 1 | 2 | 3 | 4'
        />
    <cms:editable name='bom' type='text' />
    <cms:editable         
        name='sum'
        required='0'
        type='dropdown'
        opt_values=' Sats=- | 3.8 | 3.45'
        />
    <cms:editable name="months"
                  label="Måned"
                  data-bind=""opt_values='list_months.html'
                  dynamic='opt_values'
                  type='dropdown'

                  />
</cms:template>

<!-- this is secured page. login first to access it -->
<cms:if k_logged_out >
    <cms:redirect "<cms:login_link />" />
</cms:if>

<div class="x_content">
    <div class="col-md-12 col-sm-12 col-xs-12">
        <cms:form
            masterpage='users/kjorebok.php'
            mode='create'
            enctype='multipart/form-data'
            method='post'
            anchor='0'
            >

            <cms:if k_success >

                <cms:db_persist_form
                    _invalidate_cache='0'
                    _auto_title='1'                                                   
                    />

                <cms:set_flash name='submit_success' value='1' />
                <cms:redirect k_page_link />

            </cms:if>

            <cms:if k_error >
                <div class="error">

                    <div class="alert alert-danger alert-dismissible fade in" role="alert">
                        <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
                        <cms:each k_error >
                            <cms:show item />
                        </cms:each>
                    </div>

                </div>
            </cms:if>
            <div class="clearfix"></div><br />
            <div class="col-md-1 col-sm-12 col-xs-12">                       
                <cms:input name="date" type="bound" class="form-control" placeholder="Dato" />
            </div>                       
            <div class="col-md-2 col-sm-12 col-xs-12">
                <cms:input type="bound" name="from" class="form-control" placeholder="Skriv adresse" />
            </div>
            <div class="col-md-2 col-sm-12 col-xs-12">                       
                <cms:input type="bound" name="to" class="form-control" placeholder="Skriv adresse" />
            </div>
            <div class="col-md-1 col-sm-12 col-xs-12">                       
                <cms:input type="bound" name="why" class="form-control" placeholder="Formål" />
            </div>
            <div class="col-md-1 col-sm-12 col-xs-12">                       
                <cms:input type="bound" name="km" class="form-control" placeholder="Km" />
            </div>
            <div class="col-md-1 col-sm-12 col-xs-12">                       
                <cms:input type="bound" name="pass" class="form-control" placeholder="Passasjer" />
            </div>
            <div class="col-md-1 col-sm-12 col-xs-12">                       
                <cms:input type="bound" name="bom" class="form-control" placeholder="Bompenger" />
            </div>
            <div class="col-md-1 col-sm-12 col-xs-12">                       
                <cms:input type="bound" name="sum" class="form-control" placeholder="Sats" />
            </div> 
            <div class="col-md-1 col-sm-12 col-xs-12">                       
                <cms:input type="bound" name="months" class="form-control" placeholder="Måned" />
            </div>                                                                                       
            <div class="col-md-1 col-sm-12 col-xs-12">
                <cms:if "<cms:not submit_success />" >
                <button type="submit" class="btn btn-default">OPPRETT NY</button>
                </cms:if>               
            </div>

        </cms:form>   
    </div>

</script>   
</body>
</html>

<?php COUCH::invoke(); ?>

Attachments

Following threads discuss how to set folder info using cms:db_persist_form -
viewtopic.php?f=4&t=8047
viewtopic.php?f=2&t=9593

Hope it helps.
KK wrote: Following threads discuss how to set folder info using cms:db_persist_form -
viewtopic.php?f=4&t=8047
viewtopic.php?f=2&t=9593

Hope it helps.


Thanks KK, :)

One more question related to my last post!

Now when clicking button SAVE a page is saved to folder, so thats good, but im wondering if there is possible to have a button nr.1, and when clicking this a new row is added and so on. And when the user is finnished adding rows and filling out the form he can click button nr.2 and then the form gets saved as a page to folder?

Maybe you have some solution for this! I did try to find something about this in forum but could not find anything.
For now we only have repeatable-regions that would work that way :)
Previous 1, 2, 3, 4, 5 ... 7 Next
70 posts Page 2 of 7