Sponsored Content
Top Forums Web Development MySQL Query to Build Mockup Vue.js UserCP Timeline Page Post 303031199 by Neo on Saturday 23rd of February 2019 11:08:32 AM
Old 02-23-2019
And so the current PHP file (working well in testing) is:

Code:
<?php
header("Content-Type: application/json");
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: GET, OPTIONS");
require_once('/var/www/global.php');
$timeline = "select thread.threadid, post.userid, post.username, thread.title, post.dateline,post.postid, thread.firstpostid from thread inner join post ON post.threadid = thread.threadid  order by dateline desc limit 100";

$results = $vbulletin->db->query_read($timeline);
while ($item = $db->fetch_array($results)) {
    if($item['postid'] == $item['firstpostid'])
    {
    $item['title'] =  $item['username'].' started discussion '.$item['title'];
    }
    else{
    $item['title'] =  $item['username'].' replied to '.$item['title'];
    }
    $item['when'] =  date("D M j G:i:s T Y", $item['dateline']); 
    $final[] = $item;

}

$serialize = json_encode($final);
echo  $serialize;

I will update the new build with working timeline next Smilie

Edit: Done!

https://www.unix.com/web-programming...-new-post.html
 

9 More Discussions You Might Find Interesting

1. What is on Your Mind?

Promotion! Like Our New Facebook Timeline Page for 10,000 Bits!

Hey! We have started a new Forum HQ Facebook "Timeline" page where we plan to create a unix/linux timeline with major milestones for unix/linux, company start up dates for major releases, etc. We are just getting started, so I would like to personally invite you to visit and "Like" our new... (10 Replies)
Discussion started by: Neo
10 Replies

2. Web Development

Vue.js UserCP Mockup Version 0.20 - Badge Notifications

Vue.js UserCP Mockup Version 0.20 - Badge Notifications https://www.unix.com/cp/index.php#/dashboardIn this mockup release: Badge Notifications are working with live data: Upper Right (see image) Added Axios to Vue and changed large table updates to axios (ajax) Note: Will reformat... (2 Replies)
Discussion started by: Neo
2 Replies

3. Web Development

New Discussion Timeline in Vue.js UserCP Mockup

Well, thanks to the amazing power of Vue.js, we now have a new timeline in version 0.23 of the UserCP Mockup: Wow! I'm really impressed with Vue.js. https://www.unix.com/cp/index.php#/pages/timeline In this version: Created database, and PHP model for the remote AJAX (Axios) call to... (1 Reply)
Discussion started by: Neo
1 Replies

4. Web Development

New Badge Timeline in Vue.js UserCP Mockup

Continuing to think Vue.js is AWESOME, we now have a new badges timeline in version 0.26 of the UserCP Mockup: https://www.unix.com/cp/index.php#/pages/badges Changes: Added Mockup from Badges timeline. Changed notifications (upper right) to use v-for: bindings. Fixes minor vue routing... (0 Replies)
Discussion started by: Neo
0 Replies

5. What is on Your Mind?

My Charts in the Prototype Vue.js UserCP

Yea.... something I thought would take me an hour ended up taking most of the day. Well, it's not like those YT video tutorials where it take a week or more to make a video and the guys (gals) make it look so easy. But having said that, I'm happy to share with forum members the first "My... (6 Replies)
Discussion started by: Neo
6 Replies

6. Web Development

Simple Vue.js Component to Redirect to External Web Page Using Vue Router

Vue Router has some quirks and on of the quirks is that it is not reliable when adding external links using the vue-router library. After struggling with many solutions, I have found that creating a simple Vue.js component like this one seems to work the best (so far): Component Example: ... (0 Replies)
Discussion started by: Neo
0 Replies

7. What is on Your Mind?

New UserCP Update Profile Image Page (UserCP Screeching Frog 0.7485)

Update! UserCP Screeching Frog 0.7485 Created a new page for uploaded a profile picture (profile pictures are different than avatar pictures). https://www.unix.com/usercp/#/settings/other https://www.unix.com/members/1-albums225-picture1158.png ... (0 Replies)
Discussion started by: Neo
0 Replies

8. What is on Your Mind?

UserCP Screeching Frog 0.7446 Using Vue.js

Here is a status update on the new forum usercp. The current version of the new UserCP is Screeching Frog v0.7446. Most users will need to clear the files from your browser cache, quit and restart your browser to see the new version (check bottom of the page for version). Safari seems to... (9 Replies)
Discussion started by: Neo
9 Replies

9. What is on Your Mind?

Video Overview of the Vue.js UserCP @UNIX.com

Here is my second live video screencast (in my life, using Camtasia) with voice for the new usercp: Overview of the Vue.js UserCP @UNIX.com Shout outs to Don Cragun, Corona688, Rudi, Wolf, Made in Germany, stomp, Ravinder, Creative Tim, PubNub and others in the video. Thanks. If you are... (1 Reply)
Discussion started by: Neo
1 Replies
ORLite::Migrate(3pm)					User Contributed Perl Documentation				      ORLite::Migrate(3pm)

NAME
ORLite::Migrate - Extremely light weight SQLite-specific schema migration SYNOPSIS
# Build your ORM class using a patch timeline # stored in the shared files directory. use ORLite::Migrate { create => 1, file => 'sqlite.db', timeline => File::Spec->catdir( File::ShareDir::module_dir('My::Module'), 'patches', ), user_version => 8, }; # migrate-1.pl - A trivial schema patch #!/usr/bin/perl use strict; use DBI (); # Locate the SQLite database my $file = <STDIN>; chomp($file); unless ( -f $file and -w $file ) { die "SQLite file $file does not exist"; } # Connect to the SQLite database my $dbh = DBI->connect("dbi:SQLite(RaiseError=>1):$file"); unless ( $dbh ) { die "Failed to connect to $file"; } $dbh->do( <<'END_SQL' ); create table foo ( id integer not null primary key, name varchar(32) not null ) END_SQL DESCRIPTION
SQLite is a light weight single file SQL database that provides an excellent platform for embedded storage of structured data. ORLite is a light weight single class Object-Relational Mapper (ORM) system specifically designed for (and limited to only) work with SQLite. ORLite::Migrate is a light weight single class Database Schema Migration enhancement for ORLite. It provides a simple implementation of schema versioning within the SQLite database using the built-in "user_version" pragma (which is set to zero by default). When setting up the ORM class, an additional "timeline" parameter is provided, which should be either a monolithic timeline class, or a directory containing standalone migration scripts. A "timeline" is a set of revisioned schema changed, to be applied in order and representing the evolution of the database schema over time. The end of the timeline, representing by the highest revision number, represents the "current" anticipated schema for the application. Because the patch sequence can be calculated from any arbitrary starting version, by keeping the historical set of changes in your application as schema patches it is possible for the user of any older application version to install the most current version of an application and have their database upgraded smoothly and safely. The recommended location to store the migration timeline is a shared files directory, locatable using one of the functions from File::ShareDir. The timeline for your application can be specified in two different forms, with different advantages and disadvantages. Timeline Directories A Timeline Directory is a directory on the filesystem containing a set of Perl scripts named in a consistent pattern. These patch scripts are named in the form migrate-$version.pl, where $version is the schema version to migrate to. A typical timeline directory will look something like the following. migrate-01.pl migrate-02.pl migrate-03.pl migrate-04.pl migrate-05.pl migrate-06.pl migrate-07.pl migrate-08.pl migrate-09.pl migrate-10.pl ORLite::Migrate formulates a migration plan that starts at the current database "user_version" pragma value, executing the migration script that has the version "user_version + 1", then executing "user_version + 2" and so on. It will continue stepping forwards until it runs out of patches to execute. The main advantage of a timeline directory is that each patch is run in its own process and interpreter. Hundreds of patches can be produced by many different authors, with certainty that the changes described in each will be executed as intended. The main disadvantage of using a timeline directory is that your application must be able to identify the Perl interpreter it is run in so that it can execute a sub-process. This may be difficult or impossible for cases such as PAR-packaged applications and Perl interpreters embedded inside .exe wrappers or larger non-Perl applications. In general, it is recommended that you use the timeline directory approach unless you encounter a situation in which sub-process execution (or locating the patch files) is difficult. Timeline Classes A timeline class places all of the schema patches into a single Perl module, with each patch represented as a method name. The following is an example of a trivial timeline class. package t::lib::MyTimeline; use strict; use base 'ORLite::Migrate::Timeline'; my $UPGRADE1 = <<'END_SQL'; create table foo ( id integer not null primary key, name varchar(32) not null ); insert into foo values ( 1, 'foo' ) END_SQL sub upgrade1 { my $self = shift; foreach ( split /;s+/, $UPGRADE1 ) { $self->do($_); } return 1; } sub upgrade2 { $_[0]->do("insert into foo values ( 2, 'bar' )"); } sub upgrade3 { $_[0]->do("insert into foo values ( 3, 'baz' )"); } 1; As with the patch files, the current state of the "user_version" pragma will be examined, and each "upgradeN" method will be called to advance the schema forwards. The main advantage of a timeline class is that you will not need to execute sub-processes, and so a timeline class will continue to function even in unusual or exotic process contents such as PAR packaging or .exe wrappers. The main disadvantage of a timeline class is that the entire timeline code must be loaded into memory no matter how many patch steps are needed (and stay in memory after the migration has completed), and all patches share a common interpreter and thus can potentially pollute or corrupt each other. SUPPORT
Bugs should be reported via the CPAN bug tracker at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=ORLite-Migrate <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=ORLite-Migrate> For other issues, contact the author. AUTHOR
Adam Kennedy <adamk@cpan.org> COPYRIGHT
Copyright 2009 - 2012 Adam Kennedy. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. perl v5.14.2 2012-02-02 ORLite::Migrate(3pm)
All times are GMT -4. The time now is 08:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy