TutorialMS Community Forum

Full Version: Custom News Page
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Hello, can you tell me how to create a news page. Basically I dont want the news displayed on the right column, I just want it on it's own page.
Create a new file call it *****.php (change name to what you want).

Copy and paste the following:

Code:
<?php
$news_page = 1;
require('includes/config.php');
require_once('includes/classes/template.php');
require_once('includes/functions.php');
require_once('includes/global.php');
require_once('includes/classes/tutorial.php');
echo template(CURRENT_STYLE_ID, 'header');
echo template(CURRENT_STYLE_ID, 'column_left_start');
echo bit_template(CURRENT_STYLE_ID, 'main_navbits');
echo template(CURRENT_STYLE_ID, 'column_left_end');
echo template(CURRENT_STYLE_ID, 'column_middle_start');
echo template(CURRENT_STYLE_ID, 'announcements_break');
echo bit_template(CURRENT_STYLE_ID, 'announcements_bit');
echo template(CURRENT_STYLE_ID, 'column_middle_end');
echo template(CURRENT_STYLE_ID, 'column_right_start');
echo template(CURRENT_STYLE_ID, 'site_statistics');
echo template(CURRENT_STYLE_ID, 'affiliates_break');
echo bit_template(CURRENT_STYLE_ID, 'affiliates_bit');
echo template(CURRENT_STYLE_ID, 'column_right_end');
echo template(CURRENT_STYLE_ID, 'footer');
?>

You will have to edit announcements_break and announcements_bit templates to work as you want, since they will be designed to be in the column, not in the middle.

Remove the following lines from every other file that has it. (e.g. index.php, view_tutorials.php, tutorials.php etc.)

Code:
echo template(CURRENT_STYLE_ID, 'announcements_break');
echo bit_template(CURRENT_STYLE_ID, 'announcements_bit');

Additionally, you will want to give your new page a title, so open global.php and scroll to the bottom add in an elseif that looks like this:

Code:
}elseif (isset($news_page)) {

    $glob['title'] = COMPANY_NAME.' - News Feed';

Change the title as you want it.
Okay, I created the page like you said. Now I am on step 2, the formatting.

I am having trouble with that part. If you go to http://www.newtuts.com/news.php, you can see what I mean. For the most part it looks pretty good, except its pushing the right column down below it. That is how it looks without me changing the announcements_bit or _break code. All I need is for the column thing to be fixed. How can I do this?
From looking at the source code you need to open the template "announcements_break" it probably starts with </div>, remove that and the <br /> that follows it.

Note: Remove

Code:
echo template(CURRENT_STYLE_ID, 'announcements_break');
echo bit_template(CURRENT_STYLE_ID, 'announcements_bit');

from index.php, contact_us.php, help.php, register.php, sourcesite.php, submit.php, submit2.php, tutorial_details.php, users.php, view_tutorials.php, and write.php.

If you do not your layout will be broken on those pages.

If you would want to have the news page and the news in the right column on the other pages then I can post a simple work around that will solve the problem.
Hi,

I've looked at your source:
Code:
<div id="columnmain">
           </div>
           <br />
          <div>
        <img src="http://www.newtuts.com/images/latestnews.jpg" alt="Announcements" style="margin-right:10px;" />
      </div>
        <div class="gencontainer">       <div class="rightrow1" style="white-space: normal;">
        <strong><a href="http://www.newtuts.com">Switch</a></strong><br /><br />
     <div style="padding-left: 5px;padding-right: 5px;" class="normaltext">
         Hello, just wanted to let everyone know that we have completed switching hosts! If you find any bugs or missing pages, please report them to us. Thanks!
     </div>
</div>       <div class="rightrow2" style="white-space: normal;">
        <strong><a href="http://www.newtuts.com">Problem Solved</a></strong><br /><br />
     <div style="padding-left: 5px;padding-right: 5px;" class="normaltext">
         Hello, I just wanted to let you know that we have solved the tutorial title problem! <b>So, if you experience any malfunctions at this site we ask that you please report them to us via the contact page.</b><br />
<br />
For those of you wondering, here is our current development plan for the next couple of weeks. Keep in mind we will probably not be able to stick to this schedule!<br />
1. Get footer links setup and working.<br />
2. Get our tutorial count to 100. (First major goal!)<br />
3. Find and approve affiliates. (If you want to become an affiliate, please apply!)<br />
4. Setup and integrate a forum system! (Another of our major goals)<br />
5. By this step we would like to have 200 tutorials indexed.<br />
6. Integrate ads :( (I know, I know, nobody likes ads, but at the rate of donations we are getting, ads might become a possibility)<br />
<br />
Well, thats about all we have planned for the next few weeks. I cannot gurantee that much will get done due to my hectic school schedule. But Thanksgiving is coming up soon, so hopefully I will be able to get a lot of work done then.<br />
<br />
Thanks for your cooperation and support!
     </div>
</div>       <div class="rightrow1" style="white-space: normal;border-bottom: 0;">
        <strong><a href="http://www.newtuts.com">Great Progress!</a></strong><br /><br />
     <div style="padding-left: 5px;padding-right: 5px;" class="normaltext">
         I know it may seem like the site is dead, but we have been working on many backend features for our administrators! In addition to this, we also have been busy approving new tutorials! <br />
<br />
Please, do not report to us that the tutorial titles are missing, this is a coding error on our part, and we are working on the problem. Until then, be sure to check back often, and <b>SUBMIT MORE TUTORIALS</b>.<br />
<br />
Thanks!
     </div>
</div>       </div>
You've closed your columnmain as soon as you opened it:
Code:
<div id="columnmain">
           </div>
Take the </div> and place it at the bottom of that code section:
Code:
<div id="columnmain">
           <br />
          <div>
        <img src="http://www.newtuts.com/images/latestnews.jpg" alt="Announcements" style="margin-right:10px;" />
      </div>
        <div class="gencontainer">       <div class="rightrow1" style="white-space: normal;">
        <strong><a href="http://www.newtuts.com">Switch</a></strong><br /><br />
     <div style="padding-left: 5px;padding-right: 5px;" class="normaltext">
         Hello, just wanted to let everyone know that we have completed switching hosts! If you find any bugs or missing pages, please report them to us. Thanks!
     </div>
</div>       <div class="rightrow2" style="white-space: normal;">
        <strong><a href="http://www.newtuts.com">Problem Solved</a></strong><br /><br />
     <div style="padding-left: 5px;padding-right: 5px;" class="normaltext">
         Hello, I just wanted to let you know that we have solved the tutorial title problem! <b>So, if you experience any malfunctions at this site we ask that you please report them to us via the contact page.</b><br />
<br />
For those of you wondering, here is our current development plan for the next couple of weeks. Keep in mind we will probably not be able to stick to this schedule!<br />
1. Get footer links setup and working.<br />
2. Get our tutorial count to 100. (First major goal!)<br />
3. Find and approve affiliates. (If you want to become an affiliate, please apply!)<br />
4. Setup and integrate a forum system! (Another of our major goals)<br />
5. By this step we would like to have 200 tutorials indexed.<br />
6. Integrate ads :( (I know, I know, nobody likes ads, but at the rate of donations we are getting, ads might become a possibility)<br />
<br />
Well, thats about all we have planned for the next few weeks. I cannot gurantee that much will get done due to my hectic school schedule. But Thanksgiving is coming up soon, so hopefully I will be able to get a lot of work done then.<br />
<br />
Thanks for your cooperation and support!
     </div>
</div>       <div class="rightrow1" style="white-space: normal;border-bottom: 0;">
        <strong><a href="http://www.newtuts.com">Great Progress!</a></strong><br /><br />
     <div style="padding-left: 5px;padding-right: 5px;" class="normaltext">
         I know it may seem like the site is dead, but we have been working on many backend features for our administrators! In addition to this, we also have been busy approving new tutorials! <br />
<br />
Please, do not report to us that the tutorial titles are missing, this is a coding error on our part, and we are working on the problem. Until then, be sure to check back often, and <b>SUBMIT MORE TUTORIALS</b>.<br />
<br />
Thanks!
     </div>
</div>       </div>
</div>
Hope this helps.
Hey, I still seem to be having problems. Go to http://www.newtuts.com/news.php to see what I mean. Utjames, I wasnt sure what to edit to change the columnmain thing.
On your new news template add one more </div> at the bottom.
I think that would be your announcements_bit template

Oops! Scratch that: it would be your "column_middle_end" template. Unless you don't have that included in your news page - it needs to be right after "announcements_bit"

Code:
echo template(CURRENT_STYLE_ID, 'column_middle_start');
echo template(CURRENT_STYLE_ID, 'announcements_break');
echo bit_template(CURRENT_STYLE_ID, 'announcements_bit');
echo template(CURRENT_STYLE_ID, 'column_middle_end');

Sorry about that :oops:

If "column_middle_end" is called in your news page as in the code above, then go ahead and add the </div> at the end of your "announcements_bit" template.
I added a </div> at the end of column_middle_end, and it worked for my news page, but now my other pages are messed up. Look at http://www.newtuts.com/index.php
Again, sorry :oops:

Since "column_middle_end" is there remove the </div> you just put in and add it at the end of your "announcements_bit" template.
Pages: 1 2 3
Reference URL's