CN112417341B - Method and system for displaying news data on multiple platforms - Google Patents
Method and system for displaying news data on multiple platforms Download PDFInfo
- Publication number
- CN112417341B CN112417341B CN202011445640.5A CN202011445640A CN112417341B CN 112417341 B CN112417341 B CN 112417341B CN 202011445640 A CN202011445640 A CN 202011445640A CN 112417341 B CN112417341 B CN 112417341B
- Authority
- CN
- China
- Prior art keywords
- news
- data
- content
- typesetting
- organizing
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/957—Browsing optimisation, e.g. caching or content distillation
- G06F16/9577—Optimising the visualization of content, e.g. distillation of HTML documents
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Transfer Between Computers (AREA)
Abstract
The invention provides a method for displaying news data on multiple platforms, which comprises the following steps: s1, splitting html news content into a plurality of news granularities; step S2, setting news typesetting data, wherein the news typesetting data is a mould, typesetting of news is defined, the sequence of news content blocks is set, and different types of content are filled in the content blocks after receiving the news data; step S3, setting a news data reading interface, wherein the interface is used for reading news data; step S4, reading news data through a news data interface, returning corresponding news data formats according to different platforms, and if the news data formats are webpage request data, organizing the content of each news block into complete html news data according to news typesetting data and returning the complete html news data; if the data is the app client request data, transmitting news typesetting data and content resource data of each news block, and organizing and displaying by the client; the maintainability of the data is maintained.
Description
Technical Field
The invention relates to the technical field of computer communication, in particular to a method and a system for displaying news data on multiple platforms.
Background
With the development of the Internet, news showing platforms are increasingly rich, and the news shows from early newspapers and community blackboard newspaper to current news websites, mobile terminals H5, app clients and the like. Different platforms have different display characteristics, such as more convenient and universal webpage display, and app client display pursues user experience, such as picture amplification rotation, better display experience performed by a video playing application native client plug-in, and the like. If different platforms need different data, and publishing and modifying news need to be operated to edit multiple pieces of news data, the maintainability of the news data becomes low.
Disclosure of Invention
In order to overcome the problems, the invention aims to provide a method for displaying news data on multiple platforms, which solves the limitation of the display effect of pictures and video labels of html codes in apps and maintains the maintainability of the data.
The invention is realized by adopting the following scheme: a method of news data presentation on multiple platforms, the method comprising the steps of:
s1, splitting html news content into a plurality of news granularities, wherein the news granularities comprise text content, pictures or videos;
step S2, setting news typesetting data, wherein the news typesetting data is a mould, typesetting of news is defined, the sequence of news content blocks is set, and different types of content are filled in the content blocks after receiving the news data;
step S3, setting a news data reading interface, wherein the interface is used for reading news data;
step S4, reading news data through a news data interface, returning corresponding news data formats according to different platforms, and if the news data formats are webpage request data, organizing the content of each news block into complete html news data according to news typesetting data and returning the complete html news data; and if the data is the app client request data, transmitting news typesetting data and content resource data of each news block, and carrying out organization and display by the client.
Further, the step S1 is further specifically: splitting html news content into a plurality of news granularities, namely dividing the news content into a plurality of content blocks according to the news granularities, wherein each content block comprises the following data: news id, resource type, content; the data for each content block is stored.
Further, the news typesetting data format is represented by html tags plus a json data structure, and the json data structure comprises a news id and a resource type.
Further, the step S4 is further specifically: reading news data through a news data interface, reading news typesetting data according to news id in the news data, and processing the news data according to a request source; the request source comprises a pc machine, a mobile terminal h5 or an app client; when the source of the request is pc or mobile terminal h5, replacing the corresponding content of the news typesetting data, namely, the text content blocks related to the news typesetting data, organizing text tag codes for replacement, organizing the picture content blocks related to the news typesetting data, organizing img tag codes for replacement, organizing video tag codes for replacement of the video content blocks related to the news typesetting data, and finally, organizing the news typesetting data into an html news data source for display by a computer browser and a mobile phone browser; when the request source is an app client, the news typesetting data is not reorganized, the news typesetting data and the news content block data set are returned, and the client performs display rendering.
The invention also provides a system for displaying the news data on multiple platforms, which comprises a splitting module, a data typesetting module, a reading interface setting module and a news data processing module;
the splitting module is used for splitting html news content into a plurality of news granularities, wherein the news granularities comprise text content, pictures or videos;
the data typesetting module is used for setting news typesetting data, wherein the news typesetting data is a mould, typesetting of news is defined, the sequence of news content blocks is set, and different types of content are filled in the content blocks after the news data are received;
the reading interface setting module is used for setting a news data reading interface which is used for reading news data;
the news data processing module is used for reading news data through a news data interface, returning corresponding news data formats according to different platforms, and if the news data formats are webpage request data, organizing the content of each news block into complete html news data according to news typesetting data and returning the complete html news data; and if the data is the app client request data, transmitting news typesetting data and content resource data of each news block, and carrying out organization and display by the client.
Further, the implementation manner of the splitting module is further specifically as follows: splitting html news content into a plurality of news granularities, namely dividing the news content into a plurality of content blocks according to the news granularities, wherein each content block comprises the following data: news id, resource type, content; the data for each content block is stored.
Further, the news typesetting data format is represented by html tags plus a json data structure, and the json data structure comprises a news id and a resource type.
Further, the implementation manner of the news data processing module is further specifically as follows: reading news data through a news data interface, reading news typesetting data according to news id in the news data, and processing the news data according to a request source; the request source comprises a pc machine, a mobile terminal h5 or an app client; when the source of the request is pc or mobile terminal h5, replacing the corresponding content of the news typesetting data, namely, the text content blocks related to the news typesetting data, organizing text tag codes for replacement, organizing the picture content blocks related to the news typesetting data, organizing img tag codes for replacement, organizing video tag codes for replacement of the video content blocks related to the news typesetting data, and finally, organizing the news typesetting data into an html news data source for display by a computer browser and a mobile phone browser; when the request source is an app client, the news typesetting data is not reorganized, the news typesetting data and the news content block data set are returned, and the client performs display rendering.
The invention has the beneficial effects that: the method can split news content, subdivide the news content into texts, pictures and videos, combine news typesetting data, display the news content on multiple platforms by one news data source, solve the limitation of the display effect of pictures and video labels of html codes in apps, and maintain the maintainability of the data.
Drawings
FIG. 1 is a schematic flow chart of the method of the present invention.
FIG. 2 is a schematic flow chart of an embodiment of the method of the present invention.
Fig. 3 is a system schematic block diagram of the present invention.
Detailed Description
The invention is further described below with reference to the accompanying drawings.
Referring to fig. 1, the method for displaying news data on multiple platforms according to the present invention includes the following steps:
s1, splitting html news content into a plurality of news granularities, wherein the news granularities comprise text content, pictures or videos;
step S2, setting news typesetting data, wherein the news typesetting data is a mould, typesetting of news is defined, the sequence of news content blocks is set, and different types of content are filled in the content blocks after receiving the news data;
step S3, setting a news data reading interface, wherein the interface is used for reading news data;
step S4, reading news data through a news data interface, returning corresponding news data formats according to different platforms, and if the news data formats are webpage request data, organizing the content of each news block into complete html news data according to news typesetting data and returning the complete html news data; and if the data is the app client request data, transmitting news typesetting data and content resource data of each news block, and carrying out organization and display by the client.
The invention is further described with reference to the following specific examples:
referring to fig. 2, a method for displaying news data on multiple platforms according to the present invention:
step 1: suppose we want to have a news:
step 1.1: firstly, dividing news content into 4 parts, namely dividing the news content into a plurality of news granularities, wherein the news granularities comprise text content, pictures or videos; the 4 paragraphs from top to bottom of the news are words, pictures, words and videos respectively. The following content block data table is designed:
CREATE TABLE`news_item_tb`(
`id`int(11)NOT NULL AUTO_INCREMENT,
"news_id" int (11) DEFAULT '0' COMMENT 'news id',
type ' varchar (10) Default "COMMENT ' resource type ',
the 'weight' int (11) DEFAULT '0' component 'width',
the 'height' int (11) DEFAULT '0' COMMENT 'height',
'src' varchar (300) DEFAULT 'picture/video address',
content,
`createtime`datetime DEFAULT NULL,
PRIMARY KEY(`id`)
)ENGINE=InnoDB AUTO_INCREMENT=782DEFAULT CHARSET=utf8;
step 1.2: the news content is split into 4 paragraphs for storage as follows:
step 1.3: news typesetting data is edited, and the news typesetting data prescribes the placement of news contents, and each small block consists of what contents, such as characters, pictures and videos. The typesetting data format is represented by html tag plus json data structure, and the news typesetting data of step 1 is as follows:
<p>{id:778,type:’text’}</p>
<p>{id:779,type:’img’}</p>
<p>{id:780,type:’text’}</p>
<p>{id:781,type:’video’}</p>
< p > and </p > are html tags, id represents the identity of the content block resource, and type represents the type of the content block resource. The above composition represents a news page divided into four paragraphs, the first paragraph being a piece of text content, the second paragraph being a picture, the third paragraph being a piece of text content, and the fourth paragraph being a piece of video content.
Step 2: a news data reading interface is developed, the link address rule of which is http:// api. Xxx.com/news/{ id }/{ source }. I.e. the link address of the interface includes the news number id and the source of the request.
{ id } represents a news number for reading news data, { source } represents a request source, and there are the following 3 categories pc machine, mobile terminal h5, app client. Corresponding data is returned through different request platform sources.
Step 3: and the news data reading interface receives the data request, reads news typesetting data according to the id and processes the news data according to the source.
Step 3.1: if source=pc machine or source=mobile terminal h5, replacing the corresponding content of typesetting data.
the paragraphs of type=text are replaced by organizing text label codes, and content fields are read to fill files;
type=img, reads weight, height, src fields, organizes img tag code for substitution, < img src= 'http:// img. Xxx. Com/20201129/wings. Jpg' light= '400' height= '300' >;
type = video paragraph, read weight, height, src fields, organize video tag code for replacement, < video height= '320' width= '380' > < source src= 'http:// video. Xxx.com/20201129/dgwg.mp4' type= 'video/mp4' >/video >.
Finally, the typesetting data are organized into an html news data source which is displayed by a power browser and a mobile phone browser.
Step 3.2: if source=app client, news data is not reorganized, news typesetting data and news content block data sets are returned, and the news typesetting data and the news content block data sets are displayed and rendered by the client.
Step 4: the system can also combine news typesetting data and news content block data sets to carry out data display according to different platforms, and is flexible and changeable.
Referring to fig. 3, the invention also provides a system for displaying news data on multiple platforms, which comprises a splitting module, a data typesetting module, a reading interface setting module and a news data processing module;
the splitting module is used for splitting html news content into a plurality of news granularities, wherein the news granularities comprise text content, pictures or videos;
the data typesetting module is used for setting news typesetting data, wherein the news typesetting data is a mould, typesetting of news is defined, the sequence of news content blocks is set, and different types of content are filled in the content blocks after the news data are received;
the reading interface setting module is used for setting a news data reading interface which is used for reading news data;
the news data processing module is used for reading news data through a news data interface, returning corresponding news data formats according to different platforms, and if the news data formats are webpage request data, organizing the content of each news block into complete html news data according to news typesetting data and returning the complete html news data; and if the data is the app client request data, transmitting news typesetting data and content resource data of each news block, and carrying out organization and display by the client.
The implementation mode of the splitting module is further specifically as follows: splitting html news content into a plurality of news granularities, namely dividing the news content into a plurality of content blocks according to the news granularities, wherein each content block comprises the following data: news id, resource type, content; the data for each content block is stored.
The news typesetting data format is represented by an html tag plus a json data structure, and the json data structure comprises a news id and a resource type.
The implementation mode of the news data processing module is further specifically as follows: reading news data through a news data interface, reading news typesetting data according to news id in the news data, and processing the news data according to a request source; the request source comprises a pc machine, a mobile terminal h5 or an app client; when the source of the request is pc or mobile terminal h5, replacing the corresponding content of the news typesetting data, namely, the text content blocks related to the news typesetting data, organizing text tag codes for replacement, organizing the picture content blocks related to the news typesetting data, organizing img tag codes for replacement, organizing video tag codes for replacement of the video content blocks related to the news typesetting data, and finally, organizing the news typesetting data into an html news data source for display by a computer browser and a mobile phone browser; when the request source is an app client, the news typesetting data is not reorganized, the news typesetting data and the news content block data set are returned, and the client performs display rendering.
In short, the invention divides the traditional html news content into 3 categories of text content, pictures and videos by dividing the html news content into smaller granularity. And defining the sequence of the content blocks by a piece of news typesetting data. The news typesetting data is just like a mould, the typesetting of news is defined, and different types of contents are filled in corresponding pits. And then reading the news data through the news data interface, and returning corresponding news data formats according to different platforms. If the data is the webpage request data, organizing the content of the small block into a complete html news data according to the news typesetting data, and returning the complete html news data; and if the content typesetting data is the app client request data, transmitting the content typesetting data and the content resource data of the small blocks, and carrying out organization and display by the client.
The foregoing description is only of the preferred embodiments of the invention, and all changes and modifications that come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein.
Claims (6)
1. A method for displaying news data on multiple platforms, characterized in that: the method comprises the following steps:
s1, splitting html news content into a plurality of news granularities, wherein the news granularities comprise text content, pictures or videos;
step S2, setting news typesetting data, wherein the news typesetting data is a mould, typesetting of news is defined, the sequence of news content blocks is set, and different types of content are filled in the content blocks after receiving the news data;
step S3, setting a news data reading interface, wherein the interface is used for reading news data;
step S4, reading news data through a news data interface, returning corresponding news data formats according to different platforms, and if the news data formats are webpage request data, organizing the content of each news block into complete html news data according to news typesetting data and returning the complete html news data; if the data is the app client request data, transmitting news typesetting data and content resource data of each news block, and organizing and displaying by the client;
the step S4 is further specifically: reading news data through a news data interface, reading news typesetting data according to news id in the news data, and processing the news data according to a request source; the request source comprises a pc machine, a mobile terminal h5 or an app client; when the source of the request is pc or mobile terminal h5, replacing the corresponding content of the news typesetting data, namely, the text content blocks related to the news typesetting data, organizing text tag codes for replacement, organizing the picture content blocks related to the news typesetting data, organizing img tag codes for replacement, organizing video tag codes for replacement of the video content blocks related to the news typesetting data, and finally, organizing the news typesetting data into an html news data source for display by a computer browser and a mobile phone browser; when the request source is an app client, the news typesetting data is not reorganized, the news typesetting data and the news content block data set are returned, and the client performs display rendering.
2. The method for displaying news data on multiple platforms according to claim 1, wherein: the step S1 is further specifically: splitting html news content into a plurality of news granularities, namely dividing the news content into a plurality of content blocks according to the news granularities, wherein each content block comprises the following data: news id, resource type, content; the data for each content block is stored.
3. The method for displaying news data on multiple platforms according to claim 2, wherein: the news typesetting data format is represented by an html tag plus a json data structure, and the json data structure comprises a news id and a resource type.
4. A system for displaying news data on multiple platforms, comprising: the system comprises a splitting module, a data typesetting module, a reading interface setting module and a news data processing module;
the splitting module is used for splitting html news content into a plurality of news granularities, wherein the news granularities comprise text content, pictures or videos;
the data typesetting module is used for setting news typesetting data, wherein the news typesetting data is a mould, typesetting of news is defined, the sequence of news content blocks is set, and different types of content are filled in the content blocks after the news data are received;
the reading interface setting module is used for setting a news data reading interface which is used for reading news data; the news data processing module is used for reading news data through a news data interface, returning corresponding news data formats according to different platforms, and if the news data formats are webpage request data, organizing the content of each news block into complete html news data according to news typesetting data and returning the complete html news data; if the data is the app client request data, transmitting news typesetting data and content resource data of each news block, and organizing and displaying by the client;
the implementation mode of the news data processing module is further specifically as follows: reading news data through a news data interface, reading news typesetting data according to news id in the news data, and processing the news data according to a request source; the request source comprises a pc machine, a mobile terminal h5 or an app client; when the source of the request is pc or mobile terminal h5, replacing the corresponding content of the news typesetting data, namely, the text content blocks related to the news typesetting data, organizing text tag codes for replacement, organizing the picture content blocks related to the news typesetting data, organizing img tag codes for replacement, organizing video tag codes for replacement of the video content blocks related to the news typesetting data, and finally, organizing the news typesetting data into an html news data source for display by a computer browser and a mobile phone browser; when the request source is an app client, the news typesetting data is not reorganized, the news typesetting data and the news content block data set are returned, and the client performs display rendering.
5. The system for multi-platform presentation of news data as claimed in claim 4, wherein: the implementation mode of the splitting module is further specifically as follows: splitting html news content into a plurality of news granularities, namely dividing the news content into a plurality of content blocks according to the news granularities, wherein each content block comprises the following data: news id, resource type, content; the data for each content block is stored.
6. The system for multi-platform presentation of news data as claimed in claim 5, wherein: the news typesetting data format is represented by an html tag plus a json data structure, and the json data structure comprises a news id and a resource type.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011445640.5A CN112417341B (en) | 2020-12-09 | 2020-12-09 | Method and system for displaying news data on multiple platforms |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011445640.5A CN112417341B (en) | 2020-12-09 | 2020-12-09 | Method and system for displaying news data on multiple platforms |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112417341A CN112417341A (en) | 2021-02-26 |
CN112417341B true CN112417341B (en) | 2023-04-28 |
Family
ID=74776602
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011445640.5A Active CN112417341B (en) | 2020-12-09 | 2020-12-09 | Method and system for displaying news data on multiple platforms |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112417341B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113590999A (en) * | 2021-06-23 | 2021-11-02 | 小铁世纪(成都)科技有限公司 | Adaptive content identification and release system based on small program |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20150135061A1 (en) * | 2013-11-08 | 2015-05-14 | Qualcomm Incorporated | Systems and methods for parallel traversal of document object model tree |
CN105979393A (en) * | 2015-12-01 | 2016-09-28 | 乐视致新电子科技(天津)有限公司 | Web page display method and device, and intelligent television system |
CN107590118A (en) * | 2017-08-03 | 2018-01-16 | 天脉聚源(北京)传媒科技有限公司 | A kind of method and device of the intelligent typesetting of news |
CN107885792B (en) * | 2017-10-19 | 2020-07-24 | 福建中金在线信息科技有限公司 | Webpage article display method, device and system |
CN110309462B (en) * | 2019-07-10 | 2023-05-16 | 腾讯科技(深圳)有限公司 | Data display method and system |
-
2020
- 2020-12-09 CN CN202011445640.5A patent/CN112417341B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN112417341A (en) | 2021-02-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20090177996A1 (en) | Method and system for rendering and delivering network content | |
RU2645276C2 (en) | Creation of variations when converting data to consumer content | |
CN104281827B (en) | Identify the method and device of Quick Response Code | |
US20170220547A1 (en) | Populating documents with user-related information | |
CN100426727C (en) | Image synthesis processing system and method therefor | |
WO2018053594A1 (en) | Emoji images in text messages | |
CN112765516A (en) | Page content display method and device, storage medium and electronic device | |
CN111294395A (en) | Terminal page transmission method, device, medium and electronic equipment | |
CN112417341B (en) | Method and system for displaying news data on multiple platforms | |
CN112487763A (en) | SVG-based OFD file online display method, server side and system | |
CN110826002A (en) | Information sharing method and device, terminal and storage medium | |
Hoy | An introduction to QR codes: linking libraries and mobile patrons | |
CN104239067A (en) | Making method and device of miniature client end | |
CN115495417A (en) | Content loading method, device, equipment, medium and program product | |
CN102253986A (en) | Method and device for improving webpage displaying effect in multiple terminals | |
CN115526160A (en) | Rich text processing method, device and equipment and storage medium | |
CN106021464A (en) | Universal multi-terminal editing and printing method for multimedia document | |
CN111611776A (en) | Method and device compatible with version stream document content and supporting synchronous reading | |
CN104077323A (en) | Method and device for converting web page content to multimedia messages | |
CN107330087B (en) | Page file generation method and device | |
Dragulescu et al. | Metadata methods for improving usability in moodle | |
Godwin-Jones | E-texts, mobile browsing, and rich Internet applications | |
WO2011067785A2 (en) | Dynamic content creation, modification and distribution from single source of content in online and offline scenarios | |
CN109240660B (en) | Access method of advertisement data, storage medium, electronic device and system | |
CN106682009B (en) | Method and device for generating EPUB browser page and mobile phone |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |