This website can use cookies to improve the user experience

This website can use cookies to improve the user experience and to provide certain services and functions to users. Cookies contain small amounts of information (such as login information and user preferences) and will be stored on your device.

Enable All Cookies Privacy Policy

Problem importing news from feed


avatar
cosmin 269
From: -
Problem importing news from feed

Hi. I have some problems importing a news item from a feed, as it is getting truncated. I've looked at esselbach_st_downloadqueue, esselbach_st_stories, esselbach_st_storyqueue to check for columns that may truncate the items but still can't figure out why it happens. Also I see some websites running ST now have better search engine friendly URLs (like Major Geeks, and NTCompatible, like this http://www.ntcompatible.com/CDCheck_3.1.5.0_s48671.html)
How do they do that? The SE friendly templates you released only allow changing the extension to html to get rid of the parameters.

Notice

This topic is archived. New comments cannot be posted and votes cannot be cast.

Responses to this topic


1 Re: Problem importing news from feed
avatar
Administrator
1342
From: Austria
Problem importing news from feed

Actually, this is not a single template. You need to edit both the story and the news template.
1 Re: Problem importing news from feed
avatar
0
From: -
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.
1 Re: Problem importing news from feed
avatar
Administrator
1342
From: Austria
Problem importing news from feed

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

should be:

$query = DBQuery("SELECT category_name FROM esselbach_st_categories WHERE category_id = '$id'");
1 Re: Problem importing news from feed
avatar
0
From: -
Problem importing news from feed

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

$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:

<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
1 Re: Problem importing news from feed
avatar
Administrator
1342
From: Austria
Problem importing news from feed

You need to add in the PHP part of site_header:

$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:

<title>$insert[page_title] $category_name</title>
1 Re: Problem importing news from feed
avatar
0
From: -
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
1 Re: Problem importing news from feed
avatar
Administrator
1342
From: Austria
Problem importing news from feed

You need to change in the archive_list template:

<a href="https://www.contentteller.com/archive.php?id=$insert[archive_url]">

to:

<a href="https://www.contentteller.com/archive_$insert[archive_url].html">

and then adding this mod_rewrite rule:

RewriteRule ^archive_([0-9]+).html$ archive.php?id=$1
1 Re: Problem importing news from feed
avatar
0
From: -
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?
1 Re: Problem importing news from feed
avatar
Administrator
1342
From: Austria
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.
1 Re: Problem importing news from feed
avatar
0
From: -
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?
1 Re: Problem importing news from feed
avatar
Administrator
1342
From: Austria
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?
1 Re: Problem importing news from feed
avatar
0
From: -
Problem importing news from feed

Originally posted by Philipp:
Search:

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

<?php 

global $insert;

the following:

$stitle = str_replace(" ","-",$insert[story_title]); 

$stitle = str_replace("?","",$stitle);
$stitle = htmlentities($stitle);
$stitles = $stitle."_s".$insert[story_id].".html";

Then replace:

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

with:

<li><a href="https://www.contentteller.com/$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?
1 Re: Problem importing news from feed
avatar
0
From: -
Problem importing news from feed

*bows*

Wowsers... Thanks - You're good! Wish my hosting company was as supportive as you are! Smiling Face
1 Re: Problem importing news from feed
avatar
Administrator
1342
From: Austria
Problem importing news from feed

You need to change this to:

$ctitle = str_replace(" ","-",$insert[story_category]); 

$ctitle = str_replace("?","",$ctitle);
$ctitle = htmlentities($ctitle);
$ctitlec = $ctitle."_c".$insert[story_category_id].".html";
1 Re: Problem importing news from feed
avatar
0
From: -
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="https://www.contentteller.com/$stitles">$insert[story_title]</a><br><div class=hs>$insert[story_text]<br><a href="https://www.contentteller.com/$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....
1 Re: Problem importing news from feed
avatar
Administrator
1342
From: Austria
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:

RewriteRule ^(.*)_c([0-9]+).html$ /category.php?id=$2


Then open the template category and add after

<?php

global $insert;


the following:

$ctitle = str_replace(" ","-",$insert[category_name]); 

$ctitle = str_replace("?","",$ctitle);
$ctitle = htmlentities($ctitle);
$ctitlec = $ctitle."_c".$insert[category_id].".html";

and then replace:

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

with:

<li><a href="https://www.contentteller.com/$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.
1 Re: Problem importing news from feed
avatar
0
From: -
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?
1 Re: Problem importing news from feed
avatar
Administrator
1342
From: Austria
Problem importing news from feed

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

                    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:

                    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:

RewriteRule ^(.*)_r([0-9]+)-([0-9]+).html$ /review.php?id=$2&page=$3
1 Re: Problem importing news from feed
avatar
17
From: -
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
1 Re: Problem importing news from feed
avatar
Administrator
1342
From: Austria
Problem importing news from feed

Search:

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

<?php 

global $insert;

the following:

$stitle = str_replace(" ","-",$insert[story_title]); 

$stitle = str_replace("?","",$stitle);
$stitle = htmlentities($stitle);
$stitles = $stitle."_s".$insert[story_id].".html";

Then replace:

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

with:

<li><a href="https://www.contentteller.com/$stitles">$insert[story_title]</a> ($insert[story_time])<br />


Comments:

This requires a code modification in comments.php

Find:

$insert[comment_url] = "story.php?id=$insert[comment_story]";

and replace with:

$stitle = str_replace(" ","-",$story); 

$stitle = str_replace("?","",$stitle);
$stitle = htmlentities($stitle);
$insert[comment_url] = $stitle."_s".$insert[comment_story].".html";
1 Re: Problem importing news from feed
avatar
OP 269
From: -
Problem importing news from feed

Originally posted by Philipp:
I have some problems importing a news item from a feed, as it is getting truncated. I've looked at esselbach_st_downloadqueue, esselbach_st_stories, esselbach_st_storyqueue to check for columns that may truncate the items but still can't figure out why it happens

The title or the story text? Can you give me an example.

Also I see some websites running ST now have better search engine friendly URLs (like Major Geeks, and NTCompatible, like this http://www.ntcompatible.com/CDCheck_3.1.5.0_s48671.html)
How do they do that? The SE friendly templates you released only allow changing the extension to html to get rid of the parameters.

This work with mod_rewrite as well.

Here the mod_rewrite rules for .htaccess:

RewriteRule ^(.*)_s([0-9]+).html$ /story.php?id=$2                              

RewriteRule ^(.*)_p([0-9]+).html$ /printer.php?id=$2

Then add the following to the php part of your story/news templates:

$stitle = htmlentities($insert[story_title]);                                                                                                                                                                                                                                                               

$stitles = $stitle."_s".$insert[story_id].".html";
$stitlep = $stitle."_p".$insert[story_id].".html";

and replace in the HTML part the link to the story page with $stitles and to the printer page with $stitlep. Here an example:

Posted by $insert[story_author] on: $insert[story_time] in category: $insert[story_category] [ <a href="https://www.contentteller.com/$stitlep">Print</a> | <a href="https://www.contentteller.com/$stitlel">Permalink / $insert[story_comments] Comment(s)</a

> ]<br />



Thank you Philipp. I haven't sent you that feed sample because like I said it worked out in the end.
1 Re: Problem importing news from feed
avatar
0
From: -
Problem importing news from feed

What would be the codes for the latest comments and search templates? Btw - thanks so much for the above !
1 Re: Problem importing news from feed
avatar
Administrator
1342
From: Austria
Problem importing news from feed

Here an example for the download and review section

Review

Add the following to your mod_rewrite .htaccess file:

RewriteRule ^(.*)_r([0-9]+).html$ /review.php?id=$2

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

<?php

global $insert;

the following:

$stitle = str_replace(" ","-",$insert[review_title]); 

$stitle = str_replace("?","",$stitle);
$stitle = htmlentities($stitle);
$stitler = $stitle."_r".$insert[review_id].".html";

Then replace:

 <li><a href="https://www.contentteller.com/review.php?id=$insert[review_id]">$insert[review_title]</a><br />

with:

 <li><a href="https://www.contentteller.com/$stitler">$insert[review_title]</a><br />

and save the template


Download

Add the following rule to your .htaccess file:

RewriteRule ^(.*)_d([0-9]+).html$ /download.php?det=$2

Now open the template download_cat_page in the template editor and add after:

<?php

global $insert;

the following:

$stitle = str_replace(" ","-",$insert[download_title]); 

$stitle = str_replace("?","",$stitle);
$stitle = htmlentities($stitle);
$stitled = $stitle."_d".$insert[download_id].".html";

Next replace:

 <li><a href="https://www.contentteller.com/download.php?det=$insert[download_id]">$insert[download_title]</a><br />

with:

 <li><a href="https://www.contentteller.com/$stitled">$insert[download_title]</a><br />

and save the template
1 Re: Problem importing news from feed
avatar
0
From: -
Problem importing news from feed

Originally posted by Philipp:
Not with the default configuration because mod_rewrite is only available for Apache.

However, there are similar URL rewriting extensions available for IIS:
ISAPI_Rewrite -  http://www.isapirewrite.com
IIS Rewrite -  http://www.qwerksoft.com/products/iisrewrite/

Cool, I'll look in to those.. I hate missing out on features.. Winking Face
1 Re: Problem importing news from feed
avatar
Administrator
1342
From: Austria
Problem importing news from feed

Not with the default configuration because mod_rewrite is only available for Apache.

However, there are similar URL rewriting extensions available for IIS:
ISAPI_Rewrite -  http://www.isapirewrite.com
IIS Rewrite -  http://www.qwerksoft.com/products/iisrewrite/
1 Re: Problem importing news from feed
avatar
0
From: -
Problem importing news from feed

I take it this doesn't work on IIS? Smiling Face
1 Re: Problem importing news from feed
avatar
Administrator
1342
From: Austria
Problem importing news from feed

It would be great if you posted a set of modified templates with this.

This is no official modification yet.

I'm kinda stuck trying to adapt it so it works with the download pages.

Where do you stuck?
1 Re: Problem importing news from feed
avatar
0
From: -
Problem importing news from feed

Yep, that works... thanks! Now to change the other templates Winking Face
1 Re: Problem importing news from feed
avatar
OP 269
From: -
Problem importing news from feed

It would be great if you posted a set of modified templates with this. I'm kinda stuck trying to adapt it so it works with the download pages.
1 Re: Problem importing news from feed
avatar
Administrator
1342
From: Austria
Problem importing news from feed

Two things - It doesn't seem to cope with ? question marks in headlines - such as this?

Secondly - how easy is it to change the _ (underscore) in the headlines to a - (dash)

This should work:

$stitle = str_replace(" ","-",$insert[story_title]); 

$stitle = str_replace("?","",$stitle);
$stitle = htmlentities($stitle);
$stitles = $stitle."_s".$insert[story_id].".html";
1 Re: Problem importing news from feed
avatar
0
From: -
Problem importing news from feed

I did check, honestly...ahem..found one ... so that's fixed! Thanks

Two things - It doesn't seem to cope with ? question marks in headlines - such as this?

Secondly - how easy is it to change the _ (underscore) in the headlines to a - (dash)

Instead of

Philipp_is_a_genius_s971.html

to

Philipp-is-a-genius-s971.html

This is probably the most amazing modification to this script... love it thanks again!
1 Re: Problem importing news from feed
avatar
Administrator
1342
From: Austria
Problem importing news from feed

Please verify that there is no whitespace character after $EST_TEMPLATE = <<<TEMPLATE
1 Re: Problem importing news from feed
avatar
0
From: -
Problem importing news from feed

Originally posted by Philipp:
Here the code based on your example:
<?php 

global $insert;

$stitle = htmlentities(str_replace(" ","_",$insert[story_title]));
$stitles = $stitle."_s".$insert[story_id].".html";

$EST_TEMPLATE = <<<TEMPLATE

<br /><br /><a href="https://www.contentteller.com/$stitles">Read more</a>

TEMPLATE;
?>



Tried that, but when I view the news page all of the news listings have gone and looking at the HTML :


<!-- Template login_header_user -->

<table cellspacing="0" cellpadding="0" width="100%" align="center" bgcolor="#000000" border="0">
<tr>
<td>
<table cellspacing="1" cellpadding="3" width="100%" border="0">
<tr>
<td bgcolor="#6493d4">
<font face="Verdana, Helvetica, sans-serif" size="1" color="#FFFFFF">
<b>Welcome back, user!</b>
</font>
</td>
</tr>
<tr>
<td bgcolor="#bacfec">
<font face="Verdana, Helvetica, sans-serif" size="1">
Click <a href="https://www.contentteller.com/logout.php">here</a> to logout.
</font>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br />


and then ends abruptly.

Is there a mistake in the code you posted?
1 Re: Problem importing news from feed
avatar
Administrator
1342
From: Austria
Problem importing news from feed

I think it was a line break or whitespace problem, because after erasing some blank lines and tidying text up a bit, it comes out just fine.

Can you post an example feed?

I was wondering/hoping: will you do a beta release for ST 2.0 so we can see which way it's headed?

Yes, a beta test is planned. I will post an announcement as soon it getting closer.

Does this replace or go below the following in the existing .htaccess file

It go below

What would that change to?

It should be $stitle = htmlentities(str_replace(" ","_",$insert[story_title])); and not $stitle = htmlentities($insert[story_title]); Hushed Face

Here the code based on your example:
<?php 

global $insert;

$stitle = htmlentities(str_replace(" ","_",$insert[story_title]));
$stitles = $stitle."_s".$insert[story_id].".html";

$EST_TEMPLATE = <<<TEMPLATE

<br /><br /><a href="https://www.contentteller.com/$stitles">Read more</a>

TEMPLATE;
?>
1 Re: Problem importing news from feed
avatar
0
From: -
Problem importing news from feed

I must be thick as I cannot get this to work...


Here the mod_rewrite rules for .htaccess:

RewriteRule ^(.*)_s([0-9]+).html$ /story.php?id=$2                              

RewriteRule ^(.*)_p([0-9]+).html$ /printer.php?id=$2



Does this replace or go below the following in the existing .htaccess file:

RewriteRule ^story.html$ story.php?id=1
RewriteRule ^story([0-9]+).html$ story.php?id=$1
RewriteRule ^story([0-9]+)-1.html$ story.php?id=$1
RewriteRule ^print([0-9]+).html$ printer.php?id=$1

?


Then add the following to the php part of your story/news templates:

$stitle = htmlentities($insert[story_title]);                                                                                                                                                                                                                                                               

$stitles = $stitle."_s".$insert[story_id].".html";
$stitlep = $stitle."_p".$insert[story_id].".html";




Below the lines:

<?php
global $insert;

in the template such as story template?

Tried that, but the values didn't seem to go through.... which templates exactly do I need to change?

Currently, for Read More in the news_more template I have:

<?php
global $insert;
$EST_TEMPLATE = <<<TEMPLATE

<br /><br /><a href="https://www.contentteller.com/story$insert[story_id].html">Read more</a>

TEMPLATE;
?>

What would that change to?
1 Re: Problem importing news from feed
avatar
OP 269
From: -
Problem importing news from feed

I think it was a line break or whitespace problem, because after erasing some blank lines and tidying text up a bit, it comes out just fine. Weird, really. And thank you for this providing the new templates for SEF URLs. Also, I was wondering/hoping: will you do a beta release for ST 2.0 so we can see which way it's headed?
1 Re: Problem importing news from feed
avatar
Administrator
1342
From: Austria
Problem importing news from feed

I have some problems importing a news item from a feed, as it is getting truncated. I've looked at esselbach_st_downloadqueue, esselbach_st_stories, esselbach_st_storyqueue to check for columns that may truncate the items but still can't figure out why it happens

The title or the story text? Can you give me an example.

Also I see some websites running ST now have better search engine friendly URLs (like Major Geeks, and NTCompatible, like this http://www.ntcompatible.com/CDCheck_3.1.5.0_s48671.html)
How do they do that? The SE friendly templates you released only allow changing the extension to html to get rid of the parameters.

This work with mod_rewrite as well.

Here the mod_rewrite rules for .htaccess:

RewriteRule ^(.*)_s([0-9]+).html$ /story.php?id=$2                              

RewriteRule ^(.*)_p([0-9]+).html$ /printer.php?id=$2

Then add the following to the php part of your story/news templates:

$stitle = htmlentities($insert[story_title]);                                                                                                                                                                                                                                                               

$stitles = $stitle."_s".$insert[story_id].".html";
$stitlep = $stitle."_p".$insert[story_id].".html";

and replace in the HTML part the link to the story page with $stitles and to the printer page with $stitlep. Here an example:

Posted by $insert[story_author] on: $insert[story_time] in category: $insert[story_category] [ <a href="https://www.contentteller.com/$stitlep">Print</a> | <a href="https://www.contentteller.com/$stitlel">Permalink / $insert[story_comments] Comment(s)</a

> ]<br />
1 Re: Problem importing news from feed
avatar
0
From: -
Problem importing news from feed

Yeah, that search engine friendly URL is something I have been needing for a while... having-the-title-of-the-story in the URL is great for search engines.

When can we expect to get this? I really hope this is released before 2.0.

Notice

This topic is archived. New comments cannot be posted and votes cannot be cast.