i'm writing because i need someone who can explain to me some code. I'm learning to coding on website codeavengers.
I'm doing an exercise where I have a page called index.php and 3 html pages called: 1.html, 2.html, 3.html
Each html page have this structure (with different data):
title: Responsive web design
image: /images/blog/responsive-design.png
author: Jenna Walmsley
<p> Lorem ipsum dolor </p>
<p> Lorem ipsum dolor sit amet </p>
In the exercise i have to use a php function called create_index() who basically read this 3 files and output on my webpage 3 div with this structure:
<div>
<h1>Responsive web design:</h1>
<img data-src="/images/blog/responsive-design.png" src="/images/blog/responsive-design.png">
<p> Lorem ipsum dolor </p>
<p> Lorem ipsum dolor sit amet </p>
</div>
Unlucky in the exercise is not written or explained the code of this function. Somebody can explain me with code how this function works? I'm really interested.
thanks in advance
UPDATE1 (This is the text of exercise in codeavengers)
Setting up an index page with create_index()
WordPress has many stored PHP commands that behave like plug-ins, adding features and functionality to a blog. We surround a command with PHP script tags
<?php ?>
to use that command.One example of a WordPress command is:
<?php get_header_image(); ?>
This is used to retrieve the header image for a custom header.We've created some similar commands for you to use in building your blog.
To set up your index page, you will use a command that we have created:
create_index()
. Basically, this command will search through all the files in your blog folder, retrieve the values for title, image, and content and display them neatly inindex.php
.On line 2 type the words Blog Index and surround them with
<title>
tags.
On line 3 add a stylesheet<link>
tag. Set the href attribute to blog.css.
On line 5 add a PHP require statement to include your header in index.php.
On line 7 add a PHP statement with thecreate_index()
command.
On line 9 add a PHPinclude
statement to include the footer in the file.