Jump to content

PopUpNewsModule


simpilot

Recommended Posts

  • 1 month later...
  • Administrators

hey dave, i got this error when i am veiwing a news

Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'PopUpNews::popupnewsitem' was given in /home/highva/public_html/core/classes/MainController.class.php on line 218

go up two posts B)

Link to comment
Share on other sites

  • 2 weeks later...
  • Administrators

thank you simpilot!

i got it working fine !

Now my question, when i add news the news display both on front page and on the sidebar how i can make it to display only on sidebar and configure a brand new front page without the news ?

Remove the

MainController::Run('News', newsfront, 5)

From the template

Link to comment
Share on other sites

  • 2 weeks later...

Getting an error:

Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'PopUpNews::index' was given in /core/classes/MainController.class.php on line 218

Tried reuploading the files which didn't help.

Link to comment
Share on other sites

  • Administrators

Getting an error:Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'PopUpNews::index' was given in /core/classes/MainController.class.php on line 218

Tried reuploading the files which didn't help.

Did you try the updated files up about 5 posts? Let me know how you make out. B)

Link to comment
Share on other sites

  • 4 weeks later...
  • Administrators

Great addon, works perfectly for what I need. Just one question what would the correct code be to diplay the first few sentences of the news item?

you can use the substr function from php

<?php echo substr($yourvariable, 0, 50); ?>

Will output the first 50, well actually 51 characters of your variable. you are telling it to start at character 0 and end at character 50. you can start and stop it where ever you would like. Hope this helps.

Link to comment
Share on other sites

  • 2 weeks later...

you can use the substr function from php

<?php echo substr($yourvariable, 0, 50); ?>

Will output the first 50, well actually 51 characters of your variable. you are telling it to start at character 0 and end at character 50. you can start and stop it where ever you would like. Hope this helps.

Hi Simpilot,

i found this website... http://php.net/manual/en/function.substr.php

but i cannot find out which variable i should use. I am not really into PHP, but learning. Could you give me a hint? :-)

I am trying to find the logic behind php but i am not getting it clear yet... my bad.

Thanks in advance,

Lucas

oh, by the way! Excellent module! KUDO'S!

Link to comment
Share on other sites

  • Administrators

Hi Simpilot,

i found this website... http://php.net/manual/en/function.substr.php

but i cannot find out which variable i should use. I am not really into PHP, but learning. Could you give me a hint? :-)

I am trying to find the logic behind php but i am not getting it clear yet... my bad.

Thanks in advance,

Lucas

oh, by the way! Excellent module! KUDO'S!

It will depend on what you are working on as to what to use for a variable.

In the popupnews module if you are trying to limit the characters of the subject line the data is presented in the template using the $subject variable. If you wanted to limit the subject to just say 10 characters you could do something like this in the template.

<?php echo substr($subject, 0 , 9).'...'; ?>

Which would give you something like:

Breaking N...
Link to comment
Share on other sites

  • 2 weeks later...
  • 3 weeks later...

Just installed the news module, looks great, although, my news is displayed on this page of my site - http://euroscotva.co.uk/index.php/pages/news

so it doesnt appear on my main site, and when i click an item from the module i get presented with this -

http://euroscotva.co.uk/index.php/PopUpNews/popupnewsitem/?itemid=9

my main site - http://www.euroscotva.co.uk,

Hope you can help,

Connor

Link to comment
Share on other sites

  • Administrators

Just installed the news module, looks great, although, my news is displayed on this page of my site - http://euroscotva.co.uk/index.php/pages/news

so it doesnt appear on my main site, and when i click an item from the module i get presented with this -

http://euroscotva.co.uk/index.php/PopUpNews/popupnewsitem/?itemid=9

my main site - http://www.euroscotva.co.uk,

Hope you can help,

Connor

Post number 30 in this thread has the fix for your issue.

Link to comment
Share on other sites

  • 2 months later...

I get this error

Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'PopUpNews::popupnewsitem' was given in *********core/classes/MainController.class.php on line 218

I cant seem to figure it out..

(it happens when I click the link in the list box)

Sorry, didn't see the updated version, I downloaded version 1.1 and now have it working good.

Thanks

Link to comment
Share on other sites

  • 3 weeks later...
  • Administrators

Hi simpilot,

the code you mentioned at the top: <?php echo substr($yourvariable, 0, 50); ?> could you tell me where to put it and if any changes need to be made?

Thanks

It will depend on what you are working on as to what to use for a variable.

In the popupnews module if you are trying to limit the characters of the subject line the data is presented in the template using the $subject variable. If you wanted to limit the subject to just say 10 characters you could do something like this in the template.

<?php echo substr($subject, 0 , 9).'...'; ?>

Link to comment
Share on other sites

  • 1 month later...
  • Administrators

Hi Simpilot

I put the code <?php echo substr($subject, 0 , 99); ?> in my popupnews tpl file to no avail. I still can't get the headline to show fully. Do you have any suggestions.

Thanks

The title field is limited to 30 characters in the database. If your title is longer than that, anything past the 30 characters is not being saved in the database.

Link to comment
Share on other sites

  • Administrators

I have a quick one too. I added the news module to my home page not in the side bar, but in the center. I would like to get rid of the posted on date and add the posted by author. I borrowed code from the news item tpl file and it didn't work out so smooth.

You will need to add a couple lines in the PopUpNews.php controller

after line 40 add;

Template::Set('subject', $row->subject);
Template::Set('postedby', $row->postedby);

then in the popupnews_list.tpl you will have $subject and $postedby available to you. The $posted by will only be the db id # for the poster that you will have to convert to a pilot number in the template.

  • Like 1
Link to comment
Share on other sites

You will need to add a couple lines in the PopUpNews.php controller

after line 40 add;

Template::Set('subject', $row->subject);
Template::Set('postedby', $row->postedby);

then in the popupnews_list.tpl you will have $subject and $postedby available to you. The $posted by will only be the db id # for the poster that you will have to convert to a pilot number in the template.

Thank you very much! ;) I really appreciate it. +1 for you.

**EDIT**

Worked like a charm. Thanks again!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...