Welcome, Guest. Please login or register.
Did you miss your activation email?
May 23, 2012, 07:25:14 PM

Login with username, password and session length
Search:     Advanced search
Interested in joining the WebsiteBaker team?
For more Information read here or on our new website.
155439 Posts in 21702 Topics by 7732 Members
Latest Member: Smacki
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: LAtest entry to guestbok  (Read 3501 times)
jar

Offline Offline

Posts: 62


« on: August 22, 2008, 02:13:45 PM »

i need a snnipet to show me LAtest entry to guestbok . something like the latest comments

someone? can help me ?

please
Logged
ruebenwurzel
WebsiteBaker Org e.V.

Offline Offline

Posts: 7972



WWW
« Reply #1 on: August 23, 2008, 09:42:30 AM »

Hello,

try it with the anynews snippet and replace the database query to query the guestbook.

Matthias
Logged
jar

Offline Offline

Posts: 62


« Reply #2 on: August 25, 2008, 01:41:28 PM »

Hello,

try it with the anynews snippet and replace the database query to query the guestbook.

Matthias

i dont know how !!   huh

it`s need to  replace just the name of the tabel ?
hmm !!
and i want to show just like the latest coments not like anynews ..  i try to modify the latest coments snipet and don`t work


hmmm .. can you help please ..  cry
« Last Edit: August 25, 2008, 01:45:14 PM by jar » Logged
macsmet

Offline Offline

Posts: 233


« Reply #3 on: August 25, 2008, 04:06:46 PM »

Hi Jar,

This one has been made before in 2007.
I searched the forum, downloaded it and attached it to this message.

MacSmet
Logged
jar

Offline Offline

Posts: 62


« Reply #4 on: August 25, 2008, 05:28:44 PM »

Hi Jar,

This one has been made before in 2007.
I searched the forum, downloaded it and attached it to this message.

MacSmet
where you find the snipet because i have a problem

the |show more link | does`n go on the page where is posted
Logged
doc
Guest
« Reply #5 on: August 26, 2008, 06:24:21 AM »

Hello,

I sent this code snippet some time ago to Escpro who asked for a feature to extract the latest entry from the guestbook. Maybe it helps. The code needs to be added to the index.php of your template where you want to display the guestbook entry.

Code:
<?php
// fetch last entry from guestbook table (order by timestamp)
$result $database->query("SELECT * FROM `" .TABLE_PREFIX .
  
"mod_guestbook` WHERE `approved`='1' ORDER BY `posted_when` DESC LIMIT 1");

// display last entry or a default message
if($result && $result->numRows() > 0) {
  
$data $result->fetchRow();
  
// output header with author and time (month-day-year)
  
echo '<strong>' .$wb->strip_slashes($data['name']) .' - ' .
    
date('m-d-y'$wb->strip_slashes($data['posted_when'])) .'</strong><br />';
    
  
// output guestbook message
  
echo $wb->strip_slashes($data['message']);
    
} else {
  
// no guestbook data found
  
echo 'No guestbook entry available.';
}
?>

Regards Christian

P.S.: If you are only interested in the last entry one may want to use the WB database function get_one instead (/framework/class.db.php).
« Last Edit: August 26, 2008, 06:26:15 AM by doc » Logged
jar

Offline Offline

Posts: 62


« Reply #6 on: August 26, 2008, 09:11:51 PM »

Hello,

I sent this code snippet some time ago to Escpro who asked for a feature to extract the latest entry from the guestbook. Maybe it helps. The code needs to be added to the index.php of your template where you want to display the guestbook entry.

Code:
<?php
// fetch last entry from guestbook table (order by timestamp)
$result $database->query("SELECT * FROM `" .TABLE_PREFIX .
  
"mod_guestbook` WHERE `approved`='1' ORDER BY `posted_when` DESC LIMIT 1");

// display last entry or a default message
if($result && $result->numRows() > 0) {
  
$data $result->fetchRow();
  
// output header with author and time (month-day-year)
  
echo '<strong>' .$wb->strip_slashes($data['name']) .' - ' .
    
date('m-d-y'$wb->strip_slashes($data['posted_when'])) .'</strong><br />';
    
  
// output guestbook message
  
echo $wb->strip_slashes($data['message']);
    
} else {
  
// no guestbook data found
  
echo 'No guestbook entry available.';
}
?>

Regards Christian

P.S.: If you are only interested in the last entry one may want to use the WB database function get_one instead (/framework/class.db.php).
its ok but i want to have a link to the page where is posted
and i want to have more than one comment
thanks!!
Logged
erpe

Offline Offline

Posts: 2077


WWW
« Reply #7 on: September 18, 2008, 01:50:55 PM »

Hi @all

jar is absolutely right.
The zip posted by macsmet doesn't work right with the links.
Is there someone to modify this and make it work?

Thanks in advance.

erpe
Logged

Bramus
Forum Team
*****
Offline Offline

Posts: 601


WWW
« Reply #8 on: September 18, 2008, 03:20:53 PM »

i think if you change LIMIT 1 to some other value u will get more, havent tested because still at school in a college room but think that will work.
Logged

BRAMUS Internet Services
erpe

Offline Offline

Posts: 2077


WWW
« Reply #9 on: September 18, 2008, 03:23:21 PM »

That is right, I tested it.
But the problem is the wrong link.

rgds

erpe
Logged

Bramus
Forum Team
*****
Offline Offline

Posts: 601


WWW
« Reply #10 on: September 18, 2008, 05:55:01 PM »

what do you mean by wrong link? do you have an example or something? Havent been following this thread pretty good, but will try to help
Logged

BRAMUS Internet Services
erpe

Offline Offline

Posts: 2077


WWW
« Reply #11 on: September 18, 2008, 06:12:14 PM »

Hi Bramus

thanks for helping.

Here is a link:   http://www.rvb.bplaced.net/pages/last-gb-entry.php

Page bases on modul from macsmet some posts above.
Links are not pointing to the guestbook but to the start page, for pageID=29 seems to be not right, but
the guestbook on this site is pageID=29.
So there must be something wrong in the module.

rgds

erpe
« Last Edit: September 19, 2008, 09:22:14 AM by erpe » Logged

erpe

Offline Offline

Posts: 2077


WWW
« Reply #12 on: September 20, 2008, 05:56:10 PM »

Hi Bramus,

any ideas?

rgds

erpe
Logged

jar

Offline Offline

Posts: 62


« Reply #13 on: September 22, 2008, 09:47:16 PM »

another example is on adress : www.haiinoras.ro
Logged
Bramus
Forum Team
*****
Offline Offline

Posts: 601


WWW
« Reply #14 on: September 23, 2008, 05:35:07 PM »

I'm very busy at this moment with some other projects, didnt have time to test, maybe i can test the module tomorrow cause i need to setup a test installation tomorrow anyway.
Logged

BRAMUS Internet Services
erpe

Offline Offline

Posts: 2077


WWW
« Reply #15 on: September 23, 2008, 05:57:19 PM »

Thanks for helping us.

If you want, I create an account for my testpage.
Give me an info via pm.

Thanks

erpe
« Last Edit: September 25, 2008, 12:02:53 PM by erpe » Logged

jar

Offline Offline

Posts: 62


« Reply #16 on: October 01, 2008, 01:04:42 PM »

nothing yet Huh?\
Logged
erpe

Offline Offline

Posts: 2077


WWW
« Reply #17 on: November 10, 2008, 12:03:10 PM »

Hi Bramus,

thank you for working on this snippet.
For it was not that easy to "repair" the links and for they are not really neccessary (create a link to the guestbook at the bottom or the top of this item) Bramus removed the links.

The reworked snippet can be downloaded at latest guestbook entry

rgds

erpe
Logged

Bramus
Forum Team
*****
Offline Offline

Posts: 601


WWW
« Reply #18 on: November 10, 2008, 01:03:50 PM »

nice to see the snippet is working, hope you can use it as it is now. If there needs to be any modification, let it know so i can see if i can fix it.

Bram
Logged

BRAMUS Internet Services
Frediwan

Offline Offline

Posts: 89


WWW
« Reply #19 on: May 12, 2009, 08:55:10 AM »

hi
the "read more" text/link does not appear by showing not the whole entry?
Code:
display_gb_items(368, 1, 300, 1, "The latest news", "read more", "uups, no news available",false);

and how can i use this as a droplet?

any help for me please
frediwan
« Last Edit: May 12, 2009, 09:10:28 AM by Frediwan » Logged
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!