↑ Return to W70 Tables

W78 Auto-Table Algo

by
George Morgan
My articles
Follow on:

Page no: W78

 

Explanation
Video

Tinytable: Implementation

Video Name: Auto TinyTable

Video Private

In WP Frontend

  • Implement before showing the post in front-end
  • must be an option in the post GUI
  • We will keep original content and parse it before we serve to the user
  • Once we use the algo, we will store this post for 24h and we will cache it.
  • We can always turn back and show the original content.
  • If there is a change in the algo, we can easily change the post

in FeedWordpress

  • This option will use the algo before we store our post into our database
  • This means that the algo will be used only once, not as option 1)
  • But if there is a need of change in the algo, it will be hard to be achieved

We implement both of the ways. For testing purposes we will use Option 1) and then go to option 2)

Tinytable General

Name of the plugin: Auto Tinytable

Name of folder: auto-tinytable (under wp-content/plugins)

Name of files: All files under the folder, main important: auto-tinytable.php

size: ~1000 rows

Tiny Table General
Tiny Table General

- Click to enlarge

Tinytable algorithm

The algorithm of tinytable is the best part of the whole plugin.

It is a independent functionality, which can be called everywhere we want and just transform a bunch of text into tinytable, using params added in the Global GUI.

The function firstly read the whole text and analyse it. It divide images and the text. Based on that it makes an empty tiny table (or tables) and start populating content.

main variables:

$img_array contains the images, the position, the code/name, sizes

$articleText: contains the text of whole post

 

 

Code for Automatic Tinytable
Code for Automatic Tinytable

- Click to enlarge

Splitting by Heading 

 

Next part is a new part, which is responsible for making new rows, when we see h1, h2 or h3 in the code. It must create a new row before the heading and the new row to start with the heading.

Create New TinyTable Row before Heading Starts
Create New TinyTable Row before Heading Starts

- Click to enlarge

Splitting by Max Characters (GUI parameter)

 

  1. Cutting the article text out of $articleText into the table based on the configuration inside the GUI.
  2. Copying the image row by row based on the $img_array.

First, it populate the images. They are in the second <td> column.

Second, it starts dividing the text and populating it. Here is different algorithm, which search for end of sentence in a text and cut the text after XX symbols (controlled by GUI). Then the text is populated.

 

Code for Automatic Tinytable 2
Code for Automatic Tinytable 2

- Click to enlarge

Bugs

Link to None

Link to None

  • 1) Add link via Syndication Tools
  • 2) Add link inside FeedWP
  • 3) Add link in soft HTML for Tiny Table Creation

Add the link

  •  Integrate a syndication function into FeedWP
  • Done: Improve the algo (2h) (no matter if we have or not have a link)

Link to None Problem/Solution
Link to None Problem/Solution

- Click to enlarge

Proper Testing Data

 

See more for W7x Tables