Contentteller

Contentteller Support Forums
Home Forums > Contentteller > Version 1.x >

Problem importing news from feed

Discussion in 'Version 1.x' started by cosmin, Jun 4, 2005.

Page 2 of 2
< Prev 1 2
  1. forma Guest

    Problem importing news from feed

    This is really excellent, thanks for all this info!

    The only problem I'm finding is for the review pages.

    What I would like to know is how to modify all links around the site to this new method.

    For example, when you have finished reading page 1 of a review and want to move onto page two you would usually use the "Next Page" link. What link you see here is determined by review.php and not in a termplate so how do you modify this code to link to review_graphics_card_p2.html

    thankyee
    forma, Aug 28, 2005
    #21
  2. Philipp Guest

    Problem importing news from feed

    You are looking for the following code in review.php:

    Code:
                        if ($pages > $page)                                                                                                                          
                        {                                                                                                                                            
                            $page_next = $page + 1;                                                                                                                  
                            $insert[review_next_url] = "review.php?id=$id&page=$page_next";                                                                          
                            $insert[review_next] = GetTemplate("review_next_page");                                                                                  
                        }                                                                                                                                            
                        if ($page > 1)                                                                                                                               
                        {                                                                                                                                            
                            $page_previous = $page - 1;                                                                                                              
                            $insert[review_previous_url] = "review.php?id=$id&page=$page_previous";                                                                  
                            $insert[review_previous] = GetTemplate("review_previous_page");                                                                          
                        }
    Replace it with:

    Code:
                        if ($pages > $page)                                                                                                                          
                        {                                                                                                                                            
                            $page_next = $page + 1;  
    $stitle = str_replace(" ","-",$insert[review_title]); 
    $stitle = str_replace("?","",$stitle); 
    $stitle = htmlentities($stitle); 
    $insert[review_next_url] = $stitle."_r".$insert[review_id]."-".$page_next.".html";                                                                                                                                                                                        
                            $insert[review_next] = GetTemplate("review_next_page");                                                                                  
                        }                                                                                                                                            
                        if ($page > 1)                                                                                                                               
                        {                                                                                                                                            
                            $page_previous = $page - 1;         
    $stitle = str_replace(" ","-",$insert[review_title]); 
    $stitle = str_replace("?","",$stitle); 
    $stitle = htmlentities($stitle); 
    $insert[review_previous_url] = $stitle."_r".$insert[review_id]."-".$page_previous.".html";                                                                  
                            $insert[review_previous] = GetTemplate("review_previous_page");                                                                          
                        }
    Finally, add the following mod_rewrite rule:

    Code:
    RewriteRule ^(.*)_r([0-9]+)-([0-9]+).html$ /review.php?id=$2&page=$3
    Philipp, Aug 28, 2005
    #22
  3. timbo Guest

    Problem importing news from feed

    Is it possible to change the category.php?id=7 which is, for example, used for the rap music category to:

    category-rap-music-news.html

    or something similar?

    Secondly - will these mod-rewrite functions work with the 2.0 versions and have the same IDs on stories for instance.....or will everything change?
    timbo, Oct 20, 2005
    #23
  4. Philipp Guest

    Problem importing news from feed

    Is it possible to change the category.php?id=7 which is, for example, used for the rap music category to:

    category-rap-music-news.html

    or something similar?
    Add the following mod_rewrite rule for category:

    Code:
    RewriteRule ^(.*)_c([0-9]+).html$ /category.php?id=$2
    Then open the template category and add after

    Code:
    <?php
    global $insert;
    the following:

    Code:
    $ctitle = str_replace(" ","-",$insert[category_name]); 
    $ctitle = str_replace("?","",$ctitle); 
    $ctitle = htmlentities($ctitle); 
    $ctitlec = $ctitle."_c".$insert[category_id].".html";
    and then replace:

    Code:
    <li><a href="category.php?id=$insert[category_id]">$insert[category_name]</a> ($insert[category_news] news)<br />
    with:

    Code:
    <li><a href="$ctitlec">$insert[category_name]</a> ($insert[category_news] news)<br />

    Secondly - will these mod-rewrite functions work with the 2.0 versions and have the same IDs on stories for instance.....or will everything change?
    The URLs changes in version 2.0, but there will be migration/redirection scripts available to allow the old (mod_rewrite) links.
    Philipp, Oct 20, 2005
    #24
  5. timbo Guest

    Problem importing news from feed

    That works great on category.php... but I am also using the two column display and it isn't working right on the front of the site... I have :

    (template news_col_news)

    $stitle = str_replace(" ","-",$insert[story_title]);
    $stitle = str_replace("?","",$stitle);
    $stitle = htmlentities($stitle);
    $stitles = $stitle."_s".$insert[story_id].".html";
    $ctitle = str_replace(" ","-",$insert[category_name]);
    $ctitle = str_replace("?","",$ctitle);
    $ctitle = htmlentities($ctitle);
    $ctitlec = $ctitle."_c".$insert[category_id].".html";
    and...

    <a href="$stitles">$insert[story_title]</a><br><div class=hs>$insert[story_text]<br><a href="$ctitlec"><font size=1 color=#666666>$insert[story_category]</font></a>

    Now.. $insert[story_category] is not the same as $insert[category_name] so I changed that but it isn't working either....
    timbo, Oct 20, 2005
    #25
  6. Philipp Guest

    Problem importing news from feed

    You need to change this to:

    Code:
    $ctitle = str_replace(" ","-",$insert[story_category]); 
    $ctitle = str_replace("?","",$ctitle); 
    $ctitle = htmlentities($ctitle); 
    $ctitlec = $ctitle."_c".$insert[story_category_id].".html";
    Philipp, Oct 20, 2005
    #26
  7. timbo Guest

    Problem importing news from feed

    *bows*

    Wowsers... Thanks - You're good! Wish my hosting company was as supportive as you are! :)
    timbo, Oct 20, 2005
    #27
  8. timbo Guest

    Problem importing news from feed

    Originally posted by Philipp:
    Search:

    Open the template search_list_news in the template editor and add after:

    Code:
    <?php 
    global $insert;
    the following:

    Code:
    $stitle = str_replace(" ","-",$insert[story_title]); 
    $stitle = str_replace("?","",$stitle); 
    $stitle = htmlentities($stitle); 
    $stitles = $stitle."_s".$insert[story_id].".html";
    Then replace:

    Code:
    <li><a href="story.php?id=$insert[story_id]">$insert[story_title]</a> ($insert[story_time])<br />
    with:

    Code:
    <li><a href="$stitles">$insert[story_title]</a> ($insert[story_time])<br />
    Odd, when I add this to the search page I get junk output like...

    = str_replace(" ","-",The Life Gift); = str_replace("?","",); = htmlentities(); = ."_s".296.".html";

    I added to see if it made any difference (it didn't) :

    RewriteRule ^search.html$ search.php
    RewriteRule ^search([0-9]+).html$ search.php?cat=$1
    RewriteRule ^search-([0-9]+).html$ search.php?det=$1

    to the .htaccess file - where am I going wrong?
    timbo, Jan 31, 2006
    #28
  9. Philipp Guest

    Problem importing news from feed

    Sounds like you put the PHP code in the HTML section. Can you post your entire search_list_news template?
    Philipp, Feb 1, 2006
    #29
  10. timbo Guest

    Problem importing news from feed

    Oh bugger... yes... I put the $EST_TEMPLATE = <<<TEMPLATE BEFORE the $title etc.. should of put it after... sorry!

    Do I need to keep those mod-rewrite commands for the search in my .htaccess or do they make no difference?
    timbo, Feb 1, 2006
    #30
  11. Philipp Guest

    Problem importing news from feed

    No, expect you want to link to your search page with search.html

    The other two options RewriteRule ^search([0-9]+).html$ search.php?cat=$1 and RewriteRule ^search-([0-9]+).html$ search.php?det=$1 are useless after the search function is using POST and not GET to send the data.
    Philipp, Feb 2, 2006
    #31
  12. pinkopanter Guest

    Problem importing news from feed

    Hi Philipp,

    How to rewrite the archive?
    I tried the following but didnt work out:

    RewriteEngine on
    RewriteRule ^(.*)_([0-9]+).html$ story.php?id=$2
    RewriteRule ^archive_([0-9]+).html$ archive.php?id=$1&url=$2

    and then in archive template i added:

    $sarchive = archive."_".$insert[archive_url].".html";

    If i mark it like this is ok:

    #RewriteRule ^(.*)_([0-9]+).html$ story.php?id=$2
    RewriteRule ^archive_([0-9]+).html$ archive.php?id=$1&url=$2

    What do i do wrong?
    pinkopanter, Feb 14, 2006
    #32
  13. Philipp Guest

    Problem importing news from feed

    You need to change in the archive_list template:

    Code:
    <a href="archive.php?id=$insert[archive_url]">
    to:

    Code:
    <a href="archive_$insert[archive_url].html">
    and then adding this mod_rewrite rule:

    Code:
    RewriteRule ^archive_([0-9]+).html$ archive.php?id=$1
    Philipp, Feb 14, 2006
    #33
  14. pinkopanter Guest

    Problem importing news from feed

    Hi Philipp,

    Thanks for the tip. One more question: How to include the category title in meta tags. I tried:

    <title>$insert[page_title]$insert[category_name]</title>
    and
    <title>$insert[page_title]$insert[category_title]</title>

    but none of them worked.

    Thank you
    pinkopanter, Feb 15, 2006
    #34
  15. Philipp Guest

    Problem importing news from feed

    You need to add in the PHP part of site_header:

    Code:
    $category_name = ""; 
    if ((preg_match("/category/",$_SERVER['PHP_SELF'])) and ($_GET['id'])) 
    { 
    $id = checknum($id); 
    dbconnect(); 
    $query = DBQuery("SELECT category_name FROM esselbach_st_categories WHERE category_id = ‘$id’"); 
    list($category_name) = mysql_fetch_row($query); 
    }
    and in the HTML part:

    Code:
    <title>$insert[page_title] $category_name</title>
    Philipp, Feb 15, 2006
    #35
  16. pinkopanter Guest

    Problem importing news from feed

    Originally posted by Philipp:
    You need to add in the PHP part of site_header:

    Code:
    $category_name = ""; 
    if ((preg_match("/category/",$_SERVER['PHP_SELF'])) and ($_GET['id'])) 
    { 
    $id = checknum($id); 
    dbconnect(); 
    $query = DBQuery("SELECT category_name FROM esselbach_st_categories WHERE category_id = ‘$id’"); 
    list($category_name) = mysql_fetch_row($query); 
    }
    and in the HTML part:

    Code:
    <title>$insert[page_title] $category_name</title>
    I applied this and got this error:

    Error: 1064 You have an error in your SQL syntax near '' at line 1
    pinkopanter, Feb 15, 2006
    #36
  17. Philipp Guest

    Problem importing news from feed

    Code:
    $query = DBQuery("SELECT category_name FROM esselbach_st_categories WHERE category_id = ‘$id’");
    should be:

    Code:
    $query = DBQuery("SELECT category_name FROM esselbach_st_categories WHERE category_id = '$id'");
    Philipp, Feb 16, 2006
    #37
  18. Vinnie Guest

    Problem importing news from feed

    Not sure I undertsand this so much, you have edit the story news template but we can't see a story news template! Have we looked in the wrong place?
    We tried a couple fo thigns but still have not managed to change the structure of the URL.
    Vinnie, Jan 6, 2007
    #38
  19. Philipp Guest

    Problem importing news from feed

    Actually, this is not a single template. You need to edit both the story and the news template.
    Philipp, Jan 7, 2007
    #39
Page 2 of 2
< Prev 1 2
Tweet
Facebook:
Forgot your password?
Contentteller Support Forums
Home Forums > Contentteller > Version 1.x >
  • Home
  • Forums

    Forums

    Quick Links
    • Search Forums
    • What's New?
  • Members

    Members

    Quick Links
    • Registered Members
    • Current Visitors
    • Recent Activity
  • Help

    Help

    Quick Links
    • Smilies
    • BB Codes
    • Trophies

Separate names with a comma.

Advanced search...
    Forum software by XenForo™ ©2011 XenForo Ltd.