Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

Snippit :: News source link

Asked Modified Viewed 5,638 times
D
DrunkeN
D
  • Member, joined since
  • Contributed 161 posts on the community forums.
  • Started 18 threads in the forums
  • Started this discussions
asked
Member

Hi this is a news mod as i have thinked on long time to use but i have not have the time to fix it but i saw a request some day this week and now the mod is done. I use this on my site just look at the latest new :)


Open news.php

Find
         $news_info = array(
            "news_id" => $data['news_id'],
            "user_id" => $data['user_id'],
            "user_name" => $data['user_name'],
            "user_status" => $data['user_status'],
            "news_date" => $data['news_datestamp'],
            "cat_id" => $data['news_cat'],
            "cat_name" => $data['news_cat_name'],
            "cat_image" => $news_cat_image,
            "news_subject" => $data['news_subject'],
            "news_ext" => $data['news_extended'] ? "y" : "n",
            "news_reads" => $data['news_reads'],
            "news_comments" => $comments,
            "news_allow_comments" => $data['news_allow_comments'],
            "news_sticky" => $data['news_sticky']
         );


Replace with

         $news_info = array(
            "news_id" => $data['news_id'],
            "user_id" => $data['user_id'],
            "user_name" => $data['user_name'],
            "user_status" => $data['user_status'],
            "news_date" => $data['news_datestamp'],
            "cat_id" => $data['news_cat'],
            "cat_name" => $data['news_cat_name'],
            "cat_image" => $news_cat_image,
            "news_subject" => $data['news_subject'],
            "news_ext" => $data['news_extended'] ? "y" : "n",
            "news_reads" => $data['news_reads'],
            "news_comments" => $comments,
            "news_allow_comments" => $data['news_allow_comments'],
            "news_source_url" => $data['news_source_url'],
            "news_source_title" => $data['news_source_title'],
            "news_sticky" => $data['news_sticky']
         );


Find

      $news_info = array(
         "news_id" => $data['news_id'],
         "user_id" => $data['user_id'],
         "user_name" => $data['user_name'],
         "user_status" => $data['user_status'],
         "news_date" => $data['news_datestamp'],
         "cat_id" => $data['news_cat'],
         "cat_name" => $data['news_cat_name'],
         "cat_image" => $news_cat_image,
         "news_subject" => $data['news_subject'],
         "news_ext" => "n",
         "news_reads" => $data['news_reads'],
         "news_comments" => dbcount("(comment_id)", DB_COMMENTS, "comment_type='N' AND comment_item_id='".$data['news_id']."' AND comment_hidden='0'"),
         "news_allow_comments" => $data['news_allow_comments'],
         "news_sticky" => $data['news_sticky']
      );


Replace with

      $news_info = array(
         "news_id" => $data['news_id'],
         "user_id" => $data['user_id'],
         "user_name" => $data['user_name'],
         "user_status" => $data['user_status'],
         "news_date" => $data['news_datestamp'],
         "cat_id" => $data['news_cat'],
         "cat_name" => $data['news_cat_name'],
         "cat_image" => $news_cat_image,
         "news_subject" => $data['news_subject'],
         "news_ext" => "n",
         "news_reads" => $data['news_reads'],
         "news_comments" => dbcount("(comment_id)", DB_COMMENTS, "comment_type='N' AND comment_item_id='".$data['news_id']."' AND comment_hidden='0'"),
         "news_allow_comments" => $data['news_allow_comments'],
         "news_source_url" => $data['news_source_url'],
         "news_source_title" => $data['news_source_title'],
         "news_sticky" => $data['news_sticky']
      );



Save and close news.php



Open administration/news.php



Find

$news_subject = stripinput($_POST['news_subject']);



Add this after

$news_source_url = stripinput($_POST['news_source_url']);
   $news_source_title = stripinput($_POST['news_source_title']);


Find

UPDATE ".DB_NEWS." SET news_subject='$news_subject',



Replace with

UPDATE ".DB_NEWS." SET news_subject='$news_subject', news_source_url='$news_source_url',


Find

$result = dbquery("INSERT INTO ".DB_NEWS." (news_subject, news_cat, news_news, news_extended, news_breaks, news_name, news_datestamp, news_start, news_end, news_image, news_image_t1, news_image_t2, news_visibility, news_draft, news_sticky, news_reads, news_allow_comments, news_allow_ratings) VALUES ('$news_subject', '$news_cat', '$body', '$body2', '$news_breaks', '".$userdata['user_id']."', '".($news_start_date != 0 ? $news_start_date : time())."', '$news_start_date', '$news_end_date', '$news_image', '$news_image_t1', '$news_image_t2', '$news_visibility', '$news_draft', '$news_sticky', '0', '$news_comments', '$news_ratings')");


Replace with

$result = dbquery("INSERT INTO ".DB_NEWS." (news_subject, news_source_url, news_source_title, news_cat, news_news, news_extended, news_breaks, news_name, news_datestamp, news_start, news_end, news_image, news_image_t1, news_image_t2, news_visibility, news_draft, news_sticky, news_reads, news_allow_comments, news_allow_ratings) VALUES ('$news_subject', '$news_source_url', '$news_source_title', '$news_cat', '$body', '$body2', '$news_breaks', '".$userdata['user_id']."', '".($news_start_date != 0 ? $news_start_date : time())."', '$news_start_date', '$news_end_date', '$news_image', '$news_image_t1', '$news_image_t2', '$news_visibility', '$news_draft', '$news_sticky', '0', '$news_comments', '$news_ratings')");


Find

$result = dbquery("SELECT news_subject, news_cat, news_news, news_extended, news_start, news_end, news_image, news_image_t1, news_image_t2, news_visibility, news_draft, news_sticky, news_breaks, news_allow_comments, news_allow_ratings FROM ".DB_NEWS." WHERE news_id='".(isset($_POST['news_id']) ? $_POST['news_id'] : $_GET['news_id'])."' LIMIT 1");


Replace with

$result = dbquery("SELECT news_subject, news_source_url, news_source_title, news_cat, news_news, news_extended, news_start, news_end, news_image, news_image_t1, news_image_t2, news_visibility, news_draft, news_sticky, news_breaks, news_allow_comments, news_allow_ratings FROM ".DB_NEWS." WHERE news_id='".(isset($_POST['news_id']) ? $_POST['news_id'] : $_GET['news_id'])."' LIMIT 1");


Find

$news_subject = $data['news_subject'];


Add this after

         $news_source_url = $data['news_source_url'];
         $news_source_title = $data['news_source_title'];


Find

$news_subject = "";


Add this after

         $news_source_url = "";
         $news_source_title = "";



Find

   echo "<td width='80%' class='tbl'><input type='text' name='news_subject' value='".$news_subject."' class='textbox' style='width: 250px' /></td>\n";
   echo "</tr>\n<tr>\n";


Add this after

   echo "<td width='100' class='tbl'>Source info:</td>\n";
   echo "<td width='80%' class='tbl'>Source URL: <input type='text' name='news_source_url' value='".$news_source_url."' class='textbox' style='width: 250px' />
   <br />Source title: <input type='text' name='news_source_title' value='".$news_source_title."' class='textbox' style='width: 250px' /></td>\n";
   echo "</tr>\n<tr>\n";


Save and close /administration/news.php

Now upload the files in right folders the first news we talked about in the root and this last in /administration/

Now you need to edit your theme.php file (in the render_news function) i don't know what theme as you using so i can only give the code to you and you testing it.

Here is the code for render_news function in theme.php

        /* News source */
      if (!strstr($info['news_source_url'], "http://") && !strstr($info['news_source_url'], "https://")) {
         $urlprefix = "http://";
          } else {
         $urlprefix = "";
      }
       if($info['news_source_url'] != "" && $info['news_source_title'] != ""){
           echo " <strong>Source:</strong> <a href='".$urlprefix.$info['news_source_url']."' title='".$urlprefix.$info['news_source_url']."' target='_blank'>".$info['news_source_title']."</a>";
           }
           /* News source */



And last you must add these to the news db just copy and paste in custom pages and don't click save only Preview


<?php
$result = dbquery("ALTER TABLE ".DB_NEWS." ADD news_source_url VARCHAR(250) NOT NULL DEFAULT '' AFTER news_allow_ratings");
$result = dbquery("ALTER TABLE ".DB_NEWS." ADD news_source_title VARCHAR(200) NOT NULL DEFAULT '' AFTER news_source_url");
?>
0 replies

6 posts

S
skpacman
S
My PHP-Fusion site: https://skpacman.live
  • Member, joined since
  • Contributed 150 posts on the community forums.
  • Started 25 threads in the forums
answered
Member

Nice mod. Allows to document the source of the news. Great for news aggregate sites.
0 replies
J
jikaka
J
jikaka 10
www.rusfusion.ru - russian nss
  • Veteran Member, joined since
  • Contributed 946 posts on the community forums.
  • Started 82 threads in the forums
answered
Veteran Member

great!
0 replies
M
MattMadsen
M
Facebook site
https://www.facebook.com/Detherersjovt
The funniest facebook page in the world
  • Member, joined since
  • Contributed 63 posts on the community forums.
  • Started 15 threads in the forums
answered
Member

I cant get it to work :(
U can se my files here if u want...
http://www.nook.dk/Dark/
0 replies
— 7 months later —
V
vaesir
V
vaesir 10
  • Junior Member, joined since
  • Contributed 37 posts on the community forums.
  • Started 13 threads in the forums
answered
Junior Member

@DrunkeN
I've follow your steps however I have 1 small problem.
If I use the admin panel to add a news item, it will not "hold it" I have to go in DB to add it there.
What do you think it may be the cause?
Thanks
0 replies
N
ntn
N
ntn 10
  • Junior Member, joined since
  • Contributed 19 posts on the community forums.
  • Started 8 threads in the forums
answered
Junior Member

I have fixed. DrunkeN Expert.

Thank DrunkeN
Edited by ntn on 27-12-2012 06:12,
0 replies
V
vaesir
V
vaesir 10
  • Junior Member, joined since
  • Contributed 37 posts on the community forums.
  • Started 13 threads in the forums
answered
Junior Member

Bump....:)
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 6 posts
  • Votes 0 votes
  • Topic users 6 members

6 participants

V
V
vaesir 10
  • Junior Member, joined since
  • Contributed 37 posts on the community forums.
  • Started 13 threads in the forums
N
N
ntn 10
  • Junior Member, joined since
  • Contributed 19 posts on the community forums.
  • Started 8 threads in the forums
S
S
My PHP-Fusion site: https://skpacman.live
  • Member, joined since
  • Contributed 150 posts on the community forums.
  • Started 25 threads in the forums
D
D
  • Member, joined since
  • Contributed 161 posts on the community forums.
  • Started 18 threads in the forums
  • Started this discussions
M
M
Facebook site
https://www.facebook.com/Detherersjovt
The funniest facebook page in the world
  • Member, joined since
  • Contributed 63 posts on the community forums.
  • Started 15 threads in the forums
J
J
jikaka 10
www.rusfusion.ru - russian nss
  • Veteran Member, joined since
  • Contributed 946 posts on the community forums.
  • Started 82 threads in the forums

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet