Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2014-08-12 07:22:40

widlowy
New Member
Registered: 2014-08-08
Posts: 1

Displaying specific articles on pages

Hi Everyone:-)

I need to display ads on all pages. I Know that i must create article in a section called adverts and call it properly.

I’m not sure about the code. It will be ok if i put this code?

$hostname_textpattern = “localhost”;
$database_textpattern = “<>;
$username_textpattern = “<>”;
$password_textpattern = “<>”;
$textpattern = mysql_pconnect($hostname_textpattern, $username_textpattern, $password_textpattern) or trigger_error(mysql_error(),E_USER_ERROR);
mysql_select_db($database_textpattern, $textpattern);
$query_get_advert1 = “SELECT Body_html FROM textpattern where id= 5”;
$get_advert1 = mysql_query($query_get_advert1, $textpattern) or die(mysql_error());
$row_get_advert1 = mysql_fetch_assoc($get_advert1);
$totalRows_get_advert1 = mysql_num_rows($get_advert1);
echo $row_get_advert1[‘Body_html’];
mysql_free_result($get_advert1); ?>

Last edited by widlowy (2015-10-14 05:32:39)

Offline

#2 2014-08-12 11:28:42

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,304

Re: Displaying specific articles on pages

Might this …

<txp:article_custom id="5">
   <txp:body />
</txp:article_custom>

… be what you’re after?


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

Board footer

Powered by FluxBB