Extracting data from posts

Discussion forum for MOD Writers regarding MOD Development.
Locked
BBRAIN
Registered User
Posts: 55
Joined: Tue Aug 26, 2008 10:33 am

Extracting data from posts

Post by BBRAIN »

Hi,

Here is what I am trying to accomplish.

If someone posts something like this

Image

Code: Select all

[img]http://www.lovereading.co.uk/books/covers/imported/9780575095526.jpg[/img]

[b]By Midnight: A Ravenwood Mystery[/b]

July 2010 Debut of the Month.

 

Welcome to a stunning debut and a rollercoaster emotional ride of anger, mystery, fear and romance.  This is a spooky, London-based debut Young Adult novel that cleverly intertwines Highgate cemetery, still haunted from sightings of vampires back in the 1960s and Ravenwood, an exclusive Highgate School where vampires just might lurk in the shadows.  It’s a must-read vampire story that puts the world of Edward and Bella in the shade. Why not also take a peek at the other Gollancz Young Adult titles that have helped to launch this fierce and feisty new imprint.


Is it possible to separate the image and manipulate the post to output the post on another page in this format.

Image

I would like to know how to extract the data from the post and reformat it please.

I know this is a big ask but any help would be greatly appreciated.

Thanks ;)
BBRAIN
Registered User
Posts: 55
Joined: Tue Aug 26, 2008 10:33 am

Re: Extracting data from posts

Post by BBRAIN »

Any one? I just want the script to separate the info in the image tag if anyone has an idea please... :D
xKroniK13x
Registered User
Posts: 26
Joined: Tue Feb 23, 2010 2:43 am

Re: Extracting data from posts

Post by xKroniK13x »

Well... shouldn't be all that hard... I am too tired to try to write the coding, but I would think if you used a code on this forum for just displaying posts from a forum, and change the output section to have an if statement saying that if the post data contains [img] then display a certain layout... that's what I would do. Maybe someone will do this for you.
Coding, designing, developing since 12 years old.
PHP, Javascript, HTML, Visual Basic, UnityScript and More!

http://www.coreymccown.com/
BBRAIN
Registered User
Posts: 55
Joined: Tue Aug 26, 2008 10:33 am

Re: Extracting data from posts

Post by BBRAIN »

thanks xKroniK13x that would be great ;)
BBRAIN
Registered User
Posts: 55
Joined: Tue Aug 26, 2008 10:33 am

Re: Extracting data from posts

Post by BBRAIN »

The posting bit isn't the problem, I would like to know how to use an IF statement to separate the data in the IMG tag from the rest of the post :D
BBRAIN
Registered User
Posts: 55
Joined: Tue Aug 26, 2008 10:33 am

Re: Extracting data from posts

Post by BBRAIN »

bumb
Niks_
Registered User
Posts: 16
Joined: Wed Dec 09, 2009 9:57 pm

Re: Extracting data from posts

Post by Niks_ »

I have got something like that on my forum.

For that:

Users are posting in form which are filled with picture's url etc...

In posting.php these fields are format with different html tags.
Ans i use css class to display like i wish.

So on your otherpage you have just to use a different css class.

For example:

In topic:

Code: Select all

<div class="post">
....
<div class="picture">
/* picture url */
</div>
....
</div>
 
CSS:

Code: Select all

.post.picture {
/*format in topics */
}
And on your newest page:

Code: Select all

<div class="new_page">
...
<div class="picture">
/* picture url */
</div>
...
</div>
CSS:

Code: Select all

.new_page.picture {
/*format on your newest page */
}
That's the better way i found to format the first post on my topics.
BBRAIN
Registered User
Posts: 55
Joined: Tue Aug 26, 2008 10:33 am

Re: Extracting data from posts

Post by BBRAIN »

Many thanks Niks. Will have a look into it. I don't want to change the way people post messages and make it harder. Any chance I can Have a look at your site? ;)
Niks_
Registered User
Posts: 16
Joined: Wed Dec 09, 2009 9:57 pm

Re: Extracting data from posts

Post by Niks_ »

I don't think you can do it if users are not posting in form.
Just because you'll not know on what datas you need to apply html tags.
It's not harder for users and i think it's most easy.

Fo example on your site:

Subject:.....
Picture's Url:....
Author:....
Title:...

And the message field which will not be modify.

In posting.php you have just to get back fields datas and apply html tags on it.

I send you a pm with my url site.
BBRAIN
Registered User
Posts: 55
Joined: Tue Aug 26, 2008 10:33 am

Re: Extracting data from posts

Post by BBRAIN »

Thanks m8 but I know it's just a case of searching the post for the url tag and splitting that from the rest of the post, possibly assign a variable to both and display results, I just am struggling to find any tutorials to produce the code. Am using a recent posts mod to get the data...
Niks_
Registered User
Posts: 16
Joined: Wed Dec 09, 2009 9:57 pm

Re: Extracting data from posts

Post by Niks_ »

Start to display topics in an external page.
For example by using http://blog.phpbb.com/2009/11/09/how-to ... nal-pages/, see example 2 to display 5 latest topics first post.

After that you can parse $post_text variable in order to find url tag and add css class.
Maybe it's the best solution.
BBRAIN
Registered User
Posts: 55
Joined: Tue Aug 26, 2008 10:33 am

Re: Extracting data from posts

Post by BBRAIN »

Can anyone help with the code please?

Thanks for the help m8 ;)
Locked

Return to “[3.0.x] MOD Writers Discussion”