Logo

RF Safe Tribute Site LibertyUnites Gets Big UpDate Started!

Remember
Soldiers

US Air Force

US Army

US Navy

Sept 911

World Trade Center

London

Subway

Missing

Documentation for Tributes and Prayers Export Script

PHP Script

This PHP script exports tributes and prayers (comments) from a MySQL database into JSON files. It provides two main functionalities:

  1. Export tributes to a JSON file.
  2. Export prayers to a JSON file.

Fields in the Tributes JSON File

The tributes JSON file contains the following fields:

  1. id:
    • Description: Unique identifier for each tribute.
    • Type: Integer
  2. userid:
    • Description: ID of the user who created the tribute.
    • Type: String
  3. LUID:
    • Description: Legacy Unique Identifier for the tribute.
    • Type: String
  4. category:
    • Description: Category ID of the tribute, which can be used to categorize the tribute.
    • Type: String
  5. title:
    • Description: Title of the tribute.
    • Type: String
  6. profile:
    • Description: Detailed profile or content of the tribute, typically in HTML format.
    • Type: String
  7. city:
    • Description: City related to the tribute.
    • Type: String
  8. state:
    • Description: State related to the tribute.
    • Type: String
  9. zip:
    • Description: ZIP code related to the tribute.
    • Type: String
  10. tribute_image:
    • Description: Filename or URL of the image associated with the tribute.
    • Type: String
  11. latitude:
    • Description: Latitude coordinate for the location related to the tribute.
    • Type: String
  12. longitude:
    • Description: Longitude coordinate for the location related to the tribute.
    • Type: String
  13. startdate:
    • Description: Date when the tribute was created or started.
    • Type: String (formatted date)
  14. age:
    • Description: Age of the person or entity the tribute is for.
    • Type: String
  15. occupation:
    • Description: Occupation of the person or entity the tribute is for.
    • Type: String
  16. incident:
    • Description: Description of the incident related to the tribute.
    • Type: String

Fields in the Prayers JSON File

The prayers JSON file contains the following fields:

  1. no_comment:
    • Description: Unique identifier for each prayer (comment).
    • Type: Integer
  2. id_ads:
    • Description: ID of the tribute the prayer is associated with.
    • Type: String
  3. commentby:
    • Description: ID of the user who made the comment.
    • Type: String
  4. subject:
    • Description: Subject of the prayer (comment).
    • Type: String
  5. comment:
    • Description: Content of the prayer (comment), typically in HTML format.
    • Type: String
  6. date:
    • Description: Date when the comment was made.
    • Type: String (formatted date)

 

 

Roadmap for Managing Smaller JSON Files for Tributes and Prayers

Phase 1: Initial Setup and File Creation

  1. Create Index JSON File:
    • Objective: Generate an index file with basic information for all tributes.
    • Steps:
      1. Read the existing tributes.json and prayers.json files.
      2. Combine tributes and their respective prayers.
      3. Create smaller JSON files for each tribute, including their prayers.
      4. Generate an index.json file with basic tribute details and prayer counts.
  2. Script for Splitting JSON Files:
    • Objective: Create a PHP script to split the large JSON files into smaller, individual tribute files.
    • Steps:
      1. Read the tributes.json and prayers.json files.
      2. Group prayers by tribute ID.
      3. Create a JSON file for each tribute, containing both tribute details and prayers.
      4. Save these files in a tributes directory.

Phase 2: Display and Load Tributes Dynamically

  1. Update the Tribute Listing Page:
    • Objective: Modify the tribute listing page to load data from the index.json file.
    • Steps:
      1. Load the index.json file using AJAX.
      2. Display the list of tributes based on the data in the index.json file.
      3. Implement infinite scroll or pagination for better performance.
  2. Load Tribute Details on Demand:
    • Objective: Fetch and display detailed tribute information dynamically.
    • Steps:
      1. Add event listeners for user interactions (e.g., clicking on a tribute).
      2. Load the respective JSON file for the selected tribute using AJAX.
      3. Display the detailed information, including prayers.

Phase 3: Implement Editing Functionality

  1. Create an Edit Form:
    • Objective: Develop a web form to edit tribute details and prayers.
    • Steps:
      1. Create a PHP page with a form to load and edit tribute details.
      2. Fetch and display the tribute data based on the provided LUID.
      3. Allow editing of tribute details and prayers.
      4. Include JavaScript to dynamically add and remove prayer fields.
  2. Handle Form Submissions:
    • Objective: Save the updated tribute details and prayers back to the JSON file.
    • Steps:
      1. Process the form submission using PHP.
      2. Update the respective JSON file with the new data.
      3. Provide feedback to the user (e.g., success or error messages).

Phase 4: Enhancements and Optimization

  1. Optimize Data Loading:
    • Objective: Ensure efficient data loading and updating processes.
    • Steps:
      1. Implement caching mechanisms to reduce server load.
      2. Optimize AJAX requests for better performance.
      3. Ensure proper error handling and fallback mechanisms.
  2. Security and Validation:
    • Objective: Enhance the security and validation of data handling processes.
    • Steps:
      1. Implement input validation for the edit form.
      2. Ensure proper sanitization of user inputs.
      3. Implement authentication and authorization mechanisms if necessary.
https://www.rfsafe.com/articles/cell-phone-radiation/rf-safe-tribute-site-libertyunites-gets-big-update-started.html