Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php /* Template Name: ScenesCustomPage */ ?>
- <?php
- /**
- * The template for displaying pages
- *
- * This is the template that displays all pages by default.
- * Please note that this is the WordPress construct of pages and that
- * other "pages" on your WordPress site will use a different template.
- *
- * @package WordPress
- * @subpackage Twenty_Sixteen
- * @since Twenty Sixteen 1.0
- */
- get_header(); ?>
- <div id="primary" class="content-area">
- <main id="main" class="site-main" role="main">
- <?php
- // Start the loop.
- while ( have_posts() ) : the_post();
- // Include the page content template.
- get_template_part( 'template-parts/content', 'page' );
- // If comments are open or we have at least one comment, load up the comment template.
- if ( comments_open() || get_comments_number() ) {
- comments_template();
- }
- // End of the loop.
- endwhile;
- ?>
- <?php
- global $wpdb;
- if (isset($_POST['add_scenes'])) {
- $scenes_number = $wpdb->get_var( "SELECT COUNT(*) FROM scenes" );
- echo "scenes_number: ${scenes_number}";
- $scenes = $wpdb->insert( "scenes", array (
- "idscene" => $scenes_number,
- "number" => $_POST["number"],
- "objects" => $_POST["object"],
- "characters" => $_POST["characters"],
- "typeplace" => $_POST["typeplace"],
- "modes" => $_POST["modes"],
- "status" => $_POST["status"],
- ));
- $wpdb->print_error();
- }
- ?>
-
- <?php
- global $wpdb;
- $scenes = $wpdb->get_results( "SELECT number, objects, characters, typeplace, modes, status FROM scenes" );
- if ( $scenes )
- {
- foreach ( $scenes as $sc )
- {
- echo "<p>One more character: number is {$sc->number}, modes is {$sc->modes} </p>";
- }
- }
- ?>
- <table border="1">
- <tbody>
- <tr>
- <td>Номер </td>
- <td>Объкт</td>
- <td>Персонажи</td>
- <td>Интерьер/Натура</td>
- <td>Режим</td>
- <td>Статус</td>
- </tr>
- </tbody>
- <tbody>
- <?php foreach ($scenes as $sc): ?>
- <tr>
- <td><?php echo $sc->number; ?></td>
- <td><?php echo $sc->objects; ?></td>
- <td><?php echo $sc->characters; ?></td>
- <td><?php echo $sc->typeplace; ?></td>
- <td><?php echo $sc->modes; ?></td>
- <td><?php echo $sc->status; ?></td>
- </tr>
- <?php endforeach; ?>
- </tbody>
- </table>
- <header><b>Добавление сцены</b></header>
- <form method="post" action="">
- Номер
- <input type="text" name="number" />
- Объкт
- <input type="text" name="objects" />
- Персонажи
- <input type="text" name="characters" />
- Интерьер/Натура
- <input name="typeplace" type="radio" value="Интерьер" /> Интерьер
- <input name="typeplace" type="radio" value="Натура" /> Натура
- Режим
- <input name="modes" type="radio" value="Утро" /> Утро
- <input name="modes" type="radio" value="День" /> День
- <input name="modes" type="radio" value="Вечер" /> Вечер
- <input name="modes" type="radio" value="Ночь" /> Ночь
- Статус
- <input name="status" type="radio" value="Снято" /> Снято
- <input name="status" type="radio" value="Не снято" /> Не снято
- <input type="submit" name="add_scenes" value=" Добавить сцену " />
- </form>
- </main><!-- .site-main -->
- <?php get_sidebar( 'content-bottom' ); ?>
- </div><!-- .content-area -->
- <?php get_sidebar(); ?>
- <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement