Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-03-18 15:23:11

systrum
Member
Registered: 2004-08-28
Posts: 44

last updated on ...

i want to display ‘last updated’ dates or info main page of my site which is not built in a textpattern environment (unlike my blog, which is) but assume that i would need a script to draw that info from the `LastMod` in my database.

does anyone know how i can display this info on a page not constructed in textpattern

Last edited by systrum (2006-03-18 19:32:54)

Offline

#2 2006-03-18 15:46:05

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: last updated on ...

There are a couple of plugins:
mrz_lastsitemod
ob1_modified (for individual articles)

Offline

#3 2006-03-18 19:26:46

systrum
Member
Registered: 2004-08-28
Posts: 44

Re: last updated on ...

Els – thank u. i found the ob1_modifed plugin earlier (it’s great), just that i don’t think it is of use to me as i need to be able to have this display on a page that is separate to my textpattern blog, and does not use a textpattern template. (is there a way i can get this to display for a page written in php?

the mrz_lastsitemod looks more promising, but the download link just times out. is it still available?

Offline

#4 2006-03-18 20:37:30

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: last updated on ...

systrum, I happen to have the file here. If you send me an email through the forum mailer I can mail it to you.

Offline

#5 2006-03-19 13:10:10

systrum
Member
Registered: 2004-08-28
Posts: 44

Re: last updated on ...

Els – thanks for mailing the plugin

So, it seems that i need some php script or something to get the LastMod info from my sql database onto the page i want (as the page i want to display the last updated info on is not constructed in a textpattern environment).

can anyone refer me to any scripts or any way to get the last updated info from textpattern or the database onto a page that does not use textpattern?

Offline

#6 2006-03-19 13:46:39

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: last updated on ...

Sorry I didn’t read your post very well… In my opinion it should be possible to extract the data from the database with a chunk of php. Hope someone else can help you.

Offline

#7 2006-03-19 13:47:32

systrum
Member
Registered: 2004-08-28
Posts: 44

Re: last updated on ...

anyone?

Offline

#8 2006-03-19 15:53:15

variaas
Plugin Author
From: Chicago
Registered: 2005-01-16
Posts: 402
Website

Re: last updated on ...

Systrum.

In order to pull it up on a page out side of TXP, the script must do the following: login into the database, run a sql query, and output the results. I haven’t tested this script, but I think it would look something like this:
<pre>
//Connect to the database
$dbhost = ‘localhost’;
$dbuser = ‘root’;
$dbpass = ‘password’;
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die (‘Error connecting to mysql’);
$dbname = ‘textpattern’;
mysql_select_db($dbname);

//Get the data
$query = “select LastMod from textpattern order by LastMod DESC limit 1” //I’m assuming you want the last time an article was modified
$result = mysql_query($query);
$row = mysql_fetch_array($result, MYSQL_ASSOC);

//Output the results
echo “Last Modified:{$row[‘LastMod’]} <br>”;

//Close the connection
mysql_close($conn);
</pre>

Hope that helps.

Offline

#9 2006-03-19 15:57:01

systrum
Member
Registered: 2004-08-28
Posts: 44

Re: last updated on ...

variass – thanks a lot. will try it and see how it goes

Offline

#10 2006-03-19 17:43:58

systrum
Member
Registered: 2004-08-28
Posts: 44

Re: last updated on ...

help, Parse error: syntax error, unexpected T_VARIABLE in /home/.cambyses/systrum/systrum.net/test.php on line 13

<code>
<?php

//Connect to the database
$dbhost = ‘******’;
$dbuser = ‘*****’;
$dbpass = ‘******’;
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die (‘Error connecting to mysql’);
$dbname = ‘public02’;
mysql_select_db($dbname);

//Get the data
$query = “select LastMod from textpattern order by LastMod DESC limit 1” //I’m assuming you want the last time an article was modified
$result = mysql_query($query);
$row = mysql_fetch_array($result, MYSQL_ASSOC);

//Output the results
echo “Last Modified:{$row[‘LastMod’]}
“;

//Close the connection
mysql_close($conn);

?>

</code>

Last edited by systrum (2006-03-19 17:44:37)

Offline

#11 2006-03-19 20:12:47

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: last updated on ...

You’re missing a semi-colon after $query.

Offline

#12 2006-03-19 23:34:53

systrum
Member
Registered: 2004-08-28
Posts: 44

Re: last updated on ...

do u mean inside the bracket? i still get the error if i do that.

Offline

Board footer

Powered by FluxBB