Hi @ll,
I´ve got a problem withe the TP-Article URL, only with the TP Article URL. I´ve checked the paths in the database and settings.php, everything seems 2b right.
See the problem here (http://www.otworld.de/index.php?cat=30).
http://www.otworld.de//index.php?dummy=1;page=Knieorthese
All other URL s are fine, I use also SEO4SMF, maybe the problem is there; anybody an idea?
I would think so. It changes the url, so its probably that mod. I suspect something should be between the 2 slashes, something not interpreted correctly.
hmm...
the text in the .htaccess for tiny is:
My .htaccess
#Tiny Portal Old Url's
RewriteCond %{QUERY_STRING} ^page=([0-9]*)
RewriteRule ^(.*)$ seo4smf-redirect.php?p=%1 [R=301,L]
#New Tinyportal Articles URL's
RewriteRule ^(.*)-p([0-9]*)\.html index.php?dummy=1&page=$2 [L]
but this is looking good... :'(
and the php from seo4smf
if (!empty($tpage))
{
$request = db_query("SELECT subject FROM {$db_prefix}tp_articles where id=".$tpage." limit 1", __FILE__, __LINE__);
$row = mysql_fetch_assoc($request);
mysql_free_result($request);
$scripturl1 = str_replace("/index.php", "", $scripturl);
$page_name = remove_signs($row['subject']);
$page_name = strtolower(str_replace(" ", $split_char, $page_name));
$uri = $page_name."-p".$tpage.".html";
$url = $scripturl1.'/'.$uri;
}
}
Can you please tell me, where these URLs are built?
UPDATE:
If I left the query title empty, I´ll be redirected to the index (as you can see here (http://www.otworld.de/index.php?cat=30) -> Click on the Test Article)
Unless this a problem caused by TinyPortal, you will need to ask either at SMF, or the author of the SEO4SMF mod, which is smfhacks I think.
I´ve done this, the author ist http://www.webmasterstalks.com/ (http://www.webmasterstalks.com/), but currently no response.
I think it would really help me; if anyone can tell me where the article url are built...
TPortal.php / TPortal.template.php is the files you should look in I think.
I thought as much. Can you tell it a little more concrete?
Tell you what? You're asking where the links are created. I'm telling you the file. The links are built in numerous places depending on the layout you choose etc. You'll need to look through the TPortal.php file.
OK, maybe it´s my bad English
I´ve found 3 possibilities:
Line 273
<li' , $story['id'] == $alink['id'] ? ' class="chosen"' : '' , '><a href="' . $scripturl . '?page=' . $alink['id'] . '">' , $alink['subject'] , '</a></li>';
now I have uncommentet the Rewriting for the TP URL´s but still the same...
TP doesn't re-write the URL. It only writes the URL once. It doesn't use them in any other way like the SEO mod does. What you're asking is something that needs to be changed in the SEO mod and not TP.
I found out that the problem is with SE04SMF package. From webmasterstalks site we can see that SMF 1.1.4, TinyPortal 0.9.7 and SEO4SMF are working fine but SEO4SMF is having difficulty in beautifying portal article urls with 0.9.8.
The translations of urls start from ;
$path_name = "";
if (function_exists('TPortal_init'))
if ($type == "page") //tinyportal
{
if (is_numeric($tpage_id))
{
if (isset($context['TPortal']))
{
if (isset($context['TPortal']['boardnews']))
{
foreach($context['TPortal']['boardnews'] as $bnews)
{
if ($bnews['id'] == $tpage_id)
{
$path_name = strip_tags($bnews['subject']);
$path_name = remove_signs($path_name);
$path_name = strtolower(str_replace(" ", $split_char, $path_name));
return $path_name."-p".$tpage_id.".html";
}
}
}
if ($path_name == "")
{
$path_name = scan_tp_sql($tpage_id);
return $path_name."-p".$tpage_id.".html";
}
}
in Subs-Seo4SMF.php in Sources directory. and since it cant get in the upper loop, it executes the following.
} else return "/index.php?dummy=1;page=".$tpage_id;
if you replace "/index.php" with "index.php" you will get rid of double slash but we should ask why the upper part is not working.
I think I found the reason ;
As you can see the code begins with
if (is_numeric($tpage_id))
But the page id in the url comes as ;
http://www.otworld.de//index.php?page=Knieorthese
So, since the page id is Alphabetic instead of numeric, the code cant beautify the url and passes a string as
http://www.otworld.de//index.php?dummy=1;page=Knieorthese
I see that the page id in tinyportal.co.uk is numeric. Is it a way to convert these ids to numaric ?
@MazdaClubTR
you were right; if you replace "/index.php" with "index.php the double / is vanished, but the beautifying of URL still doesn´t work. Everything else seems 2b OK
@freeman78
Good to hear that it helped a bit.
The problem lies on how TP writes the URL . You can see that at home page of this site the article id is displayed numeric ;
http://www.tinyportal.net/index.php?page=77
where both on your site and on my test site they are displayed as alphanumeric. If we can make TP write page ids as numeric the problem will be solved..
OK; I try 2 find something....; your method of resolution sounds like a good idea...
don´t you think, that its more easy to change the following string in the .htaccess...
#Tiny Portal Old Url's
RewriteCond %{QUERY_STRING} ^page=([0-9]*)
RewriteRule ^(.*)$ seo4smf-redirect.php?p=%1 [R=301,L]
like the rewriting for actions?
First I should tell that I dont have much of a knowledge on PHP but looking at the code it looks for strings as ;
page=<number>
how will you be changing the code where your TP send links as ;
page=Knieorthese
Besides the code you refer on .htaccess has affect only when you write the url on browsers address bar. The beautifying is completely done on Subs-Seo4SMF.php as far as I have seen.
Something should be done on TP side..
In 0.9.8 any page is written as page=alphanumeric..it uses the article's "short-title" field. If it doesn't contain anything the id is used. So both page=mypage and page=34 is valid. This will not change for any other mod's benefit I am afraid, its one of TP's features to be able to use both ways.
I don't quite understand why this mod can't use alphanumeric as well as numeric values though, since it can apparently beautify topic numbers? But i suspect its because its written for 0.9.7 where ONLY id's were used for page=.
...One of the goals of TP 1.0 will be to expand the built-in SEO of SMF to also convert TP query-strings though, I am hoping that will make things better for the SEO aspect.
Thanks for the reply Bloc.
Yes probably it is cause the mod was written for 0.9.7 . Since I couldnt find any 0.9.7 package I could download, I had to install 0.9.8 to my SMF 1.1.4 and it caused this problem.
Is there any way to force the TP to use numeric values on 0.9.8 ?
Ok, I found the solution, while creating article, if you leave "Query Title" empty, the SEO4SMF mod works fine.
Thanks for the hint Bloc ;)
Yes, as you discovered lol. :)
:o this was what I thought first; if I left the Query Title empty, the rewriting from URL´s works, but the goal is not the article but the index :buck2: as you can see here...
http://www.otworld.de/test2-p18.html (http://www.otworld.de/test2-p18.html)
I´m getting crazy...
@freeman78,
do you mean Headers' links as http://www.otworld.de/index.php#4 ?