CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Dynamic includes

Print topic Send  topic

Author Message
Waspman

Posts: 948
Posted: 09/09/2015, 12:59 PM

Did anyone ever do this?

Just playing around with a cms and wondered if CCS could be used.

Simple stuff really, you save element blocks as includes i.e.

<?php include_once('./elements/image.php');?>

Then they are assigned to a page and called when loaded.

Never managed to get it to work, just wondered if someone had?


Thanks


Tony

_________________
http://www.waspmedia.co.uk
View profile  Send private message
DataDoIT
Posted: 09/09/2015, 4:15 PM

Of course includes can be dynamically displayed. Place your includable
page, and in the parent page's BeforeShow put the conditions for showing
or not.

http://www.codechargecms.com
MichaelMcDonald

Posts: 640
Posted: 09/09/2015, 4:16 PM

You may have to read the image file in as binary, declare it in a variable, and then decode / stream it.
_________________
Central Coast, NSW, Australia.

View profile  Send private message
Waspman

Posts: 948
Posted: 09/10/2015, 1:00 AM

Thanks guys,

No what I mean't was that a user could assign an include to a page in a given position (or with relevant styling) which would be called when the page is built. Does't matter now, I've decided to use Bolt CMS.


_________________
http://www.waspmedia.co.uk
View profile  Send private message
Waspman

Posts: 948
Posted: 09/10/2015, 4:00 AM

Scratch that:)

Just installed Bolt and PageKit and neither do what I want.

So back to the drawing board.

Primarily I want authors to submit content, whether it be text, images or video. That content can then be approved and assigned to the relevant section by the editor and it will appear on the site in the appropriate places(pages, sections, categories) All of this I can do.

The issue with including components(pages) is to do with building the pages of the site. So the administrator will create a section add categories and then pages. Each of the pages will include the elements(php pages) that they choose in whatever order they choose .

So a typical page element list would call the text.php element, the image.php element and a list.php element. All of them filtered by the section/category of the page and listed in an order defined by the administrator.

I use Foundation so the element code would be:

<div class="large-12 medium-12 small-12 columns">
<?php include_once('./elements/image.php');?>
</div>

It would be called "Full-width image element" and the administrator would simply select from a drop down and assign a show order.

So there's the rub, getting the included pages to be called when the main container page calls them.

These pages will not have been already loaded so making something visible isn't an option. (or is it?)

Any ideas guys:)





_________________
http://www.waspmedia.co.uk
View profile  Send private message
Waspman

Posts: 948
Posted: 09/10/2015, 4:36 AM

Here's an idea.

Having built several sites using concrete5 they kinda get round this issue by using template pages. Admittedly you can still call php pages into the various positions on a page, but it might be a way to get round this issue in CCS, ready made pages. Only issue would be hiding the elements that aren't used, by which I mean the divs, but I think I can sus that out.

What do you think?
_________________
http://www.waspmedia.co.uk
View profile  Send private message
Waspman

Posts: 948
Posted: 09/10/2015, 7:26 AM

Done it!

Like Concrete 5, i create templates with various components pre-installed and then they are assigned to the pages based on section and category ID by the administrator.

I can now have simple author screens without the fear of them seeing or modifying system settings. And the admin can approve and assign as required.

There's some life in CCS yet:)



_________________
http://www.waspmedia.co.uk
View profile  Send private message
DataDoIT
Posted: 09/10/2015, 4:54 PM

That's why I included the link to http://www.codechargecms.com

That whole thing is built dynamically based on the conditions of the
viewport. Notice the URL. It is all wrapped in the index page, where
each and every widget, if you will, is logically visible or not. The
exact same concept around WordPress.

The project only has a single CCS page - index.ccp. Everything else is
an includable element.

Behind the scenes, each element (ie: Meta menu, a post, recent comments,
etc) has a spot on the screen, such as right column row 1 or main column
footer. Those are kept in the database and controlled by both a global
administrator followed by user preferences.

Additionally, the meta tags for the index.ccp page are dynamically
populated based on conditions of the viewport. Ex: The title tag,
description, keywords for SEO, etc.

Look at the source for the site and see the CCS bind events. You'll see
each includable. That part is a little aggravating in how it is done
with CodeCharge, but it works.
Waspman

Posts: 948
Posted: 09/10/2015, 10:44 PM

It's a good solution DD. Initially I wanted to include the the components dynamically at point of loading and didn't like the idea of have elements "waiting in the wings" How you make things visible seems the only way to do this with CCS. However, having used many CMS I prefer the specific template approach. I can still load all the dynamic stuff and only the components that are needed are on page, no empty div's etc.

Anyway, I've done it now. Interestingly, I've just installed the latest versions of both PageKit and Bolt, they both use a template engine to create the container page layouts, and that's kinda what CCS is in my approach.

Thanks for your input.

Tony
_________________
http://www.waspmedia.co.uk
View profile  Send private message
MichaelMcDonald

Posts: 640
Posted: 09/11/2015, 12:18 AM

Some hide/show divs using jquery getting a variable from a standard listbox, the onchange event and a hidden field.

I run my jquery at the bottom of the page just above the </body> tag.

Important to be mindful when using listboxes that a page refresh could reset the value and so affect the hide/show of the div. I usually link the select values to a database table.

Also, once you have the value from the listbox, etc,,, you can ajax post it to the same page, CCGetFromPost it and put in the before show event of textbox/ hidden, it, then get it from the hidden/textbox and set it as a session to put in another hidde/textbox where it will be consistent thru page refresh and then use jquery to retrieve that value. Sounds like a big loop, but does work.

<script type="text/javascript">
$().ready(function() {
var groupid = $("#user1groupid").find('option:selected').val();
if(groupid == 0){
$("#user1cardid").hide();
$("#user1idinterfacetype").hide();
$("#user1idtimezone").hide();
}

var groupid2 = $('#user1groupid2').val();
var idinterfacetype = $('#user1idinterfacetype').val();

if(groupid2 == 1){
$("#user1lblinterfacetype").show();
$("#user1lbltimezone").show();
$("#user1idinterfacetype").show();
$("#user1idtimezone").show();
}

if(idinterfacetype !== 1){
$("#user1idtimezone").hide();
$("#user1lbltimezone").hide();
}
if(idinterfacetype == 1){
$("#user1idtimezone").show();
$("#user1lbltimezone").show();
}

$('#user1idinterfacetype').change(function(){
var idinterfacetype = $(this).find('option:selected').val();

if(idinterfacetype !== 1){
$("#user1idtimezone").hide();
$("#user1lbltimezone").hide();
}
if(idinterfacetype == 1){
$("#user1idtimezone").show();
$("#user1lbltimezone").show();
}
});

$('#user1groupid').change(function(){
var groupid = $(this).find('option:selected').val();

if(groupid !== 1){
$("#user1cardid").hide();

$("#user1idinterfacetype").hide();
$("#user1idtimezone").hide();
$("#user1lblinterfacetype").hide();
$("#user1lbltimezone").hide();
$("#user1lblpayrollcardid").hide();
}

if(groupid == 1){
$("#user1cardid").show();
$("#user1cardid1").show();
$("#user1idinterfacetype").show();
$("#user1lblinterfacetype").show();
$("#user1lbltimezone").show();
}
});

$('#user1idinterfacetype').change(function(){
var idinterfacetype = $(this).find('option:selected').val();

if(idinterfacetype !== 1){
$("#user1idtimezone").hide();
$("#user1lbltimezone").hide();
}
if(idinterfacetype == 1){
$("#user1idtimezone").show();
$("#user1lbltimezone").show();
}
});
var groupid = $("#user1groupid").find('option:selected').val();
if(groupid == 0){

$("#user1cardid").hide();
$("#user1idinterfacetype").hide();
$("#user1idtimezone").hide();

}
});
</script>
_________________
Central Coast, NSW, Australia.

View profile  Send private message
Waspman

Posts: 948
Posted: 09/11/2015, 1:27 AM

Thanks MMD, but I think the template approach is better for me.
_________________
http://www.waspmedia.co.uk
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.