ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Message: fopen() [function.fopen]: Filename cannot be empty

May 22, 2011 11:29am

Subscribe [4]
  • #1 / May 22, 2011 11:29am

    Franka

    54 posts

    Hi,

    Still learning to use new things in ExpressionEngine v2.1.3.
    I made a website and now my client wants to add a list on his page.
    So I installed NB CSV To Table version 2.0 and added a new field to upload the file.
    Now the client can upload his excel file as csv-file and the website shows the list as a table.
    I uploaded a test csv-file and it works (after biting all my nails not as easy as I thought) ... but if I open a page without csv-file I get:

    A PHP Error was encountered
    Severity: Warning
    Message: fopen() [function.fopen]: Filename cannot be empty
    Filename: nb_csv_to_table/pi.nb_csv_to_table.php
    Line Number: 60
    Cannot open file

    Even as I try to put an if around it
    {if csv_file != ""}
    {exp:nb_csv_to_table file="{csv_file}” table_class=“standaard” id=“playlisttable” header_rows=“1|3” header_class=“ColumnOne” row_class=“ColumnTwo” show_row_count=“no” delimiter=”;” enclosure=’”’}{/if}

    Please help
    Thanks

  • #2 / May 22, 2011 4:18pm

    Greg Salt

    3988 posts

    Hi Franka,

    Firstly, please contact the author of that addon and let them know that it is possible to generate an error if a filename is not passed correctly. Now, your conditional should work and prevent the plugin code from running. Did you copy the conditional code from another document by any chance? Please try retyping it making sure that the quotes are straight and not curly and also just put the csv_file tag on it’s on above the conditional. Is anything at all output from that tag?

    Cheers

    Greg

  • #3 / May 26, 2011 10:06am

    Franka

    54 posts

    Hi Greg,

    I consulted Nicolas Bottari (writer of the addon NB CSV to Table) with the same question
    He made changes to his addon: no error and added a conditional.

    But I have an other issue/error that occurs on the same page.

    In case of an entry with no csv-file, the page (also in the source code) displays avatar, bio, email and title
    But in case of an entry with a csv-file, the page displays email, title and the csv-file as correct table.

    In the template (laserlog_index: an embeded template) I have in short version:

    {exp:channel:entries channel=”{embed:channel_name}” orderby=“date” sort=“desc”}
    {title}
    <div class=“table_standaard”>
    {exp:nb_csv_to_table file=”{csv_file}” table_class=“standaard” id=“playlisttable” header_rows=“1|3” header_class=“ColumnOne” row_class=“rowone|rowtwo” show_row_count=“no” delimiter=”;” enclosure=’ ‘}
    </div>
    {comments}
    {/exp:channel:entries}

    In the template laserlog, who has the embed template, I have in short version:

    {exp:channel:entries channel=“channelone” limit=“1” orderby=“date” sort=“desc” }
    {avatar_url}
    {bio}
    {email}
    {embed=“website/laserlog_index” channel_name=”{channel_name}”}
    {/exp:channel:entries}

    The bio has no ” and no ;
    If I empty the bio same reply
    The bio, avatar and email are the personal settings of the users in EE.

    Perhaps you can help me with this.
    Thanks

  • #4 / May 26, 2011 6:39pm

    Brandon Jones

    5500 posts

    Hi Franka,

    I’m a bit confused on the goal here. Are you wanting to not display a table when there is no CSV file?

  • #5 / May 27, 2011 9:14am

    Franka

    54 posts

    Hi Greg,

    Just like if there is a bio: display the bio. No bio filled: no bio on the page.
    If there is a csv-file: display the csv-file as table. No csv-file no table.
    Nicolas has written the condition in the addon (if csv-file etc).
    When there is not a csv-file, there is no problem. If there is a bio and/or avatar it will be displayed.
    When the user ads a csv-file in the csv-file field then there is the problem of not displaying bio nor avatar.
    But it displays only the email. Very strange.

    I hope you are not confused any more and can help me with this?
    Thanks

  • #6 / May 28, 2011 2:58pm

    Greg Salt

    3988 posts

    Hi Franka,

    I’m afraid that I’m not sure what it is that you’re trying to achieve. Is it the case that the contents of the avatar and bio fields are never being displayed? If that is correct then you will need to use the Custom Profile Data tag. If that is not correct then please try and explain exactly what needs to happen with these templates.

    Cheers

    Greg

  • #7 / May 28, 2011 4:39pm

    Franka

    54 posts

    Hi Greg,

    I try again to explain.
    I have an entry of an user. I want to display the contents of the entry with the avatar, bio and email of that user so:

    Display on page:
    {avatar}
    {bio}
    {email}
    {title}
    {text}
    {csv-file}

    If the user uploads a csv-file in the entry. You see on page:
    {email}
    {title}
    {text}
    {csv-file}
    so avatar and bio are gone!!!!!!

    If the user did not upload a csv-file. You see on page:
    {avatar}
    {bio}
    {email}
    {title}
    {text}
    {csv-file}

    Question why?

  • #8 / May 28, 2011 4:44pm

    Greg Salt

    3988 posts

    Hi Franka,

    Okay. Just so I’m clear; the avatar, bio and email fields are custom fields in a field group that is assigned to a channel and this CSV file is uploaded to this channel either through the CP or via a frontend form (SAEF or Safecracker)? The avatar, bio and email fields are not the default member custom fields. Is that correct?

    Cheers

    Greg

  • #9 / May 28, 2011 5:00pm

    Franka

    54 posts

    Hi Greg,
    now I’m getting confused.

    {title}, {text} and {csv-file} are fields in an entry in a channel of the user.

    {avatar}, {bio} and {email} are the personal settings of the user under ‘my account’: user (edit profle, edit avatar, email settings) so they are assigned to the user. Is that the same as default member custom fields?

    The user only uses CP.

    Cheers back

  • #10 / May 28, 2011 5:09pm

    Greg Salt

    3988 posts

    Hi Franka,

    Okay, I understand now. The only member variable that is global out of those is the email one. In order to display the avatar_url and the bio member custom fields you will need to use the Custom Profile Data tag. If you do not use the Custom Profile Data tag then you would see those variables just output to the template like this:

    {bio}

    Cheers

    Greg

  • #11 / May 28, 2011 5:33pm

    Franka

    54 posts

    Hi Greg,

    Thanks for the reply.
    I’m going to try to use Custom Profile Data tag.
    But it still is a mistery.
    If the user hadn’t ask for adding a new field for a table; the page would still work fine (avatar, bio, email, title and text were just diplayed correctly).

    regards,
    Franka

  • #12 / May 28, 2011 5:37pm

    Greg Salt

    3988 posts

    Hi Franka,

    Is the template where the profile fields are displayed accessible? Do you have a link so we see what is happening on this template?

    Cheers

    Greg

  • #13 / May 28, 2011 7:08pm

    Franka

    54 posts

    Hi Greg,

    I send you a message. If you want to see the template, I’ll send you a msg.

    But in the meanwhile I’m looking why I didn’t know that I had to use Custom Profile Data tag. When you read the user guide for example: http://ellislab.com/expressionengine/user-guide/modules/comment/entries.html, the avatar-url is just a variable you can use.

    Why I wanted to use a addon to make tables is because users here all use Word/excel or program’s like that to cut and paste text in an entry. And because I didn’t want a lot of invisable ... markup in a table I looked for an addon to have more control over this.

    regards,
    Franka

  • #14 / May 29, 2011 8:10am

    Greg Salt

    3988 posts

    Hi Franka,

    Both those links that you sent seem to display properly for me and I don’t see any unparsed variables. On the second template (the one without the CSV file) I can see the user image, email and bio. If you log out and view the site as a guest they should appear for you as well. Please confirm that is the case.

    But in the meanwhile I’m looking why I didn’t know that I had to use Custom Profile Data tag. When you read the user guide for example: http://ellislab.com/expressionengine/user-guide/modules/comment/entries.html, the avatar-url is just a variable you can use.

    This is correct. I’m sorry if I confused you -  I didn’t realise that you were associating each user with those particular entries.

    Cheers

    Greg

  • #15 / May 29, 2011 9:10am

    Franka

    54 posts

    Hi Greg,

    I tried to send you 2 screenshots and got the message that your box is full.

    But it is still a problem if I’m logged in or not.

    If there is a csv-file in the entry the page doesn’t show bio nor avatar (the photo you see is a picture I display if the avatar is not available in this case the avatar and picture are the same I’m sorry).

    If there is no csv-file in the entry the page shows avatar and bio. Same page, same templates.

    Cheers
    Franka

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases