i have a phpscript in one of summary template
[template/inc_cntpart/articlesummary/userinfo.tmpl]---------------
(...)
[PHP]
include("config.php");
(...)
$sql_command="SELECT * FROM tablemysql WHERE id_page='".$_GET[id]."'";
(...)
[/PHP]
(...)
----------------------------------
the .$_GET[id]. variable render the full article code (1,11,0,0,1,0)....
what can i use to to get only the article tag (11)?
OR
how do i insert an article tag {SUB},{SUMMARY} in the PHP script?
like
$sql_command="SELECT * FROM tablemysql WHERE id_entidade='".{SUB}."'";
One of these solutions would help me a lot!
if anyone could help...
how do i GET the article ID in a phpscript in template.tmpl?
i've change the code to
$sql_command="SELECT * FROM tablemysql WHERE id_page='".$_GET[entidade]."'";
and edited the .htaccess to
RewriteRule ^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.phtml$ index.php?id=$1,$2,$3,$4,$5,$6&entidade=$2
in the frontend everything is okay, but in the backend, the preview pages are index.php?id=.... so it doesnt work....
anybody have another (better) solution?
$sql_command="SELECT * FROM tablemysql WHERE id_page='".$_GET[entidade]."'";
and edited the .htaccess to
RewriteRule ^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.phtml$ index.php?id=$1,$2,$3,$4,$5,$6&entidade=$2
in the frontend everything is okay, but in the backend, the preview pages are index.php?id=.... so it doesnt work....
anybody have another (better) solution?
hi there
not sure of the specifics of your call
- but in article summary templates
- there are a lot of globals that are already available
LIST Template
$id = {ARTICLEID};
FULL SUMMARY Template
$id = $GLOBALS['content']['article_id'];
Code above was used to show number of comments in article summary list and full - required some editing of content.func.inc.php
Hope this helps

not sure of the specifics of your call
- but in article summary templates
- there are a lot of globals that are already available
LIST Template
$id = {ARTICLEID};
Code: Select all
// ARTICLEID = ID of list entry
[TITLE]<h1>{TITLE}</h1>[/TITLE]
<div class="entrymeta">{WAK_ARTICLE_CREATED:MEDIUM} | Category: {BREADCRUMB}</div>
[PHP]
$id = {ARTICLEID};
$query ="SELECT acontent_id FROM ".DB_PREPEND." phpwcms_articlecontent WHERE acontent_aid='$id' AND acontent_type='18'";
$result = mysql_query($query) or die(mysql_error());
$numRows = mysql_num_rows($result);
if($numRows>0){
$row = mysql_fetch_array($result);
$guestbook_id = $row[0];
$query ="SELECT COUNT(*) FROM ".DB_PREPEND." phpwcms_guestbook WHERE guestbook_cid='$guestbook_id' ";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result);
$number = $row[0];
mysql_free_result($result);
echo '<p><a class="comments-link" href="{ARTICLELINK}">Comments ('.$number.') Read More...</a></p>';
}else{
echo '<p><a class="read-link" href="{ARTICLELINK}"> Read More...</a></p>';
}
[/PHP]
FULL SUMMARY Template
$id = $GLOBALS['content']['article_id'];
Code: Select all
[TITLE]<h1>{TITLE}</h1>[/TITLE]
<div class="entrymeta">{WAK_ARTICLE_CREATED:MEDIUM} | Category: {BREADCRUMB}</div>
[PHP]
$id = $GLOBALS['content']['article_id'];
$query ="SELECT acontent_id FROM ".DB_PREPEND." phpwcms_articlecontent WHERE acontent_aid='$id' AND acontent_type='18'";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result);
$guestbook_id = $row[0];
$query ="SELECT COUNT(*) FROM ".DB_PREPEND." phpwcms_guestbook WHERE guestbook_cid='$guestbook_id' ";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result);
$number = $row[0];
mysql_free_result($result);
if($guestbook_id!=0){
echo "<div class=\"comments_fullarticle\">Comments (".$number.")</div>";
}
[/PHP]
Hope this helps

Re: how do i GET the article ID in a phpscript in template.tmpl?
it did! sorry to didnt reply at the time!
thanks a lot!
thanks a lot!