thedigicraft / Atom.CMS

Atom.CMS
56 stars 52 forks source link

Creating Dynamic Page Content Vid #98-102 #143

Open buttbuttle opened 8 years ago

buttbuttle commented 8 years ago

Perhaps not an error but I'm having trouble figuring out how to execute different page templates on the front end using the 'views' method, I'm trying to build a different page template for home, the navigation pages, and a gallery slider, while still having these 3 templates work with the content from the database. home template example: objective is changing image with links hovering

nav template ex: pic w/ longtext content below

I have finished all the code up to Part 102, and want to be able to pop in a dynamic page content triggered by the navigation. And I think I have all the code in place, but am unable to change the 'name' inputs in the views array (for example I made a file called 'test.php' and popped it in the views folder with 'page.php', this is the array:

Array
(
    [id] => 1
    [label] => pages
    [name] => page
    [status] => 1
)

this is the call on the index.php:

        <?php include(DIR_VIEW.'/'.$view['name'].'.php'); ?>

and these are my variables:

$page = data_post($dblink, $path['call_parts'][0]);
$view = data_post_type($dblink, $page['type']);

but the problem I'm finding is how to utilize the post_type database and 'name' input to change for multiple page templates. If that's too confusing I can give more information, sorry, and thanks.

creptor commented 8 years ago

I didn't understand you, but if you're looking for a slide show (haven't done this) image or video to a certain page you can do it as I did.

Here is an example. (just made it up really quick) image

Here is the code: (it's not inside the page main text)

<?php if($slideshow == $page['id']){ ?>
<div id="slider_top">
    <div class="slideshow_video_background"></div>
    <video class="StretchtoFit" autoplay loop muted><source src="uploads/Winions.mp4" type="video/mp4"></video>
</div>
<?php } ?>

So you can replace it with like If($page['slideshow']!=null){ and add a custom image or video just by setting the respective PHP conditions with you database..... (I recommend this for large images that're just above everything) Here is another example:

<?php If($page['slideshow']!=null && $page['slider_data']!= ){?>
<div id="slider_top">
    <?php if($page['slideshow']==1){?>
    <div class="slideshow_video_background"></div>
    <video class="StretchtoFit" autoplay loop muted><source src="<?php echo $page['slider_data'];?>" type="...."></video>
    <?php }if($page['slideshow']==2){?>
    <img ......></img>
    <?php }?>
</div>
<?php } ?>
buttbuttle commented 8 years ago

Oh thank you so much! That will certainly help.

I guess what I was trying to say, is that in Video 54 (https://www.youtube.com/watch?v=oH1Rvr_UjIo), we cover the 'views' method, to change pages and have different content (different types of forms, insert navigation, etc.) within the basic header structure (template structure that looks like:

template > header.php

navigation.php footer.php

all components that make up a the website template) and individual pages that work within the template to call up views folder (dashboard, navigation, pages, etc.) to change your page content.

We had set up a similar system for views on the front end using the database, but I'm not sure how to change the database page content (using forms, gallery, and layout change) for front end that calls both the structure (like a slide gallery structure or form structure) and the content within the structure (i.e. page of the gallery slider).

Similar to tumblr's or any blog structure where you have 'post' content, but you can change type of structure or format of content, and still change the content being called from the database. Sorry if that still doesn't make sense, if not I'll just try to figure out on my own. Thank you.

buttbuttle commented 8 years ago

nevermind, found out I was an idiot.... I had to change the type number in the database to pull up structure. thank you, and sorry.