Important announcements from CouchCMS team
54 posts Page 5 of 6
Previous 1, 2, 3, 4, 5, 6 Next
Many thanks for your help [and apologies it's taken me a few days to have a look at this]
I've resolved the page_title issue and it has imported OK except that the other fields are blank eg _Club_ID
Below is the section of code I've used

Code: Select all
<cms:db_persist
                        _auto_title       = '0'
                        _invalidate_cache = '0'
                        _masterpage       = 'clubs.php'
                        _mode             = 'create'

                        k_page_title      = "<cms:show _Club/>"
         
                       
               
         Club_ID          = _Club_ID
                        Club_URL          = _club_url
                        Club_logo   = _club_logo
         Club      = _Clubname
         

                    >

Could you advise what may be the issue?
Many thanks
Jerry
Any ideas anyone? I just can't get this to work
Many thanks
I maybe could take a look at this.. PM me all the details tomorrow. Probably something overlooked and easy to fix.
Hello everyone! Everything works great!
Hello All!

I am working on this csv importer module.

It is straight forward and is implemented. All is working except one small thing. My CSV file has only 20 line items (1 column header + 19 data lines). But when I import it goes on to import 100s' of lines. This i am unable to understand since the file is empty.

My code and csv files are as attached below.

Any help would be appreciated.

Regards,
Aashish

Attachments

Image
where innovation meets technology
I guess it was a chache issue. It is solved.

EDIT#1: SOLVED, SOLUTION BELOW
But that brings me to another challenge as i am approaching one problem at a time.

I have a relational field in data.php defined as:
Code: Select all
<cms:editable name="agent" label="Agent" type="relation" has="one" masterpage="users/index.php" order="9" />


In the import-data.php I want the Agent name from the csv file to be set in the editable region value above. This is a relation field, so how do I set it?

Regards,
Aashish

SOLUTION
I did the following to read the relational field from CSV file.
Code: Select all
<cms:capture into="agent_id">
    <cms:pages masterpage="users/index.php" custom_field="pseudo_fname=<cms:show _agent />" limit="1">
        <cms:show k_page_id />
    </cms:pages>
</cms:capture>


in my case I have a pseudo_name editable that is needed in my use case. Hence I have used the custom_field parameter. If one needs to do away with the k_page_title system field, then the <cms:pages> can be set as:
Code: Select all
<cms:pages masterpage="users/index.php" page_title=_agent limit="1">
    <cms:show k_page_id />
</cms:pages>


NOTE: Reading through the forum I have found that it is important to provide the id of the relation field to set its value in the backend.

Regards,
Aashish
Image
where innovation meets technology
This is more efficient:
<cms:pages masterpage="users/index.php" page_title=_agent limit="1" ids_only="1" />
trendoman wrote: This is more efficient:
<cms:pages masterpage="users/index.php" page_title=_agent limit="1" ids_only="1" />


@trendoman
Wish you a very happy new year!
Thanks for the feedback. I will incorporate the suggestion you provided. It would be worth it!

Regards,
Aashish
Image
where innovation meets technology
Is there a way to run the importer csv script on page load, rather than a button. Just need to setup a Cron Job for the importer and it won't do it if there is a button.

Hope someone can help.
@RedEarthDesigns, suppose the URL of your page is
https://www.yoursite.com/csv.php
or with prettyURLS -
https://www.yoursite.com/csv/

you may append '?import=1' to it making it as follows -
https://www.yoursite.com/csv.php?import=1
or with prettyURLS -
https://www.yoursite.com/csv/?import=1

And that should cause it to skip showing the button and jump straight into importing.

Hope this helps.
Previous 1, 2, 3, 4, 5, 6 Next
54 posts Page 5 of 6