Jump to content


Photo
- - - - -

How to create a page template?

template

  • Please log in to reply
16 replies to this topic

#1 John Olsson

John Olsson

    Advanced Member

  • Members

  • 43 posts
  • Framework Version:1.0.3
  • Country: Country Flag

Posted 12 October 2013 - 12:39 PM

I've tried to search for it but couldn't find it.. How do I create a simple page template inside my dms child-theme?

 

Let's call in for example: template-custum.php

 

..Or is it possible?



#2 batman

batman

    Bat Learning

  • Members

  • 1738 posts
  • LocationBuenos Aires, Argentina
  • Framework Version:DMS
  • Country: Country Flag

Posted 12 October 2013 - 01:39 PM

Hi @John Olsson

Please, you can see

http://docs.pageline...per/dms-theming

Perhaps you can find something in this



#3 John Olsson

John Olsson

    Advanced Member

  • Members

  • 43 posts
  • Framework Version:1.0.3
  • Country: Country Flag

Posted 12 October 2013 - 01:47 PM

Tnx, but.. hm, but i'll want to create a page template, a single page template from the backend, where I can for example build an advanced php-code or other..?



#4 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts
  • LocationEast Coast, USA
  • Framework Version:The Latest, of course
  • Country: Country Flag

Posted 12 October 2013 - 04:36 PM

Hello John,

 

A template in DMS is built on the front end, not the back end. I'm unclear what you mean about PHP, but DMS is largely dynamic and doesn't use old-fashioned theme type PHP pages.

 

Were you intending to add some PHP code snippet into a template?



#5 John Olsson

John Olsson

    Advanced Member

  • Members

  • 43 posts
  • Framework Version:1.0.3
  • Country: Country Flag

Posted 12 October 2013 - 05:53 PM

No, i'll understand that.. :) I looove DMS..

 

For example.. I want to use the dynamics of DMS and WP, and on top of this, i'll want to create a sort of.. don't know really how to explain it easely, but it's about photos, and uploading photos, som db-connections as well, outside the WP-db.. Theres gonna be quite advanced code, big ones..

 

Let's say i'll create a single page in wp/dms.. it's called "photos", i'll simple wanna input my own code in the template part, and load the header and footer as usual..

 

In the front-end:

 

(Header)

 

(Template) - For example, i'll just want to include "custum.php" here..

 

(Footer)

 

Does it make sense? :)



#6 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts
  • LocationEast Coast, USA
  • Framework Version:The Latest, of course
  • Country: Country Flag

Posted 12 October 2013 - 06:09 PM

If it's a PHP script, there's a much simpler way of doing this than what you're describing.

 

Get this plugin:  http://wordpress.org...tcode-exec-php/  and activate it.  Read the docs on that link.

 

Add your custom PHP code to that plugin, leaving out any HTML (no body, html, or head tags).  The plugin will help you create a shortcode. Copy the shortcode.

 

Make a template in DMS with no sidebars.  Add a single column section. 

 

Add a Textbox to the single column section.

 

In the Textbox, paste the shortcode.

 

Publish the page.

 

Save the template with a new, unique name and description.  Publish again.

 

Use that template on any pages you want to apply it to, and your script will work on it.



#7 John Olsson

John Olsson

    Advanced Member

  • Members

  • 43 posts
  • Framework Version:1.0.3
  • Country: Country Flag

Posted 12 October 2013 - 06:12 PM

I'll try that. Let me get back for a... review... or so.. :) Tnx Rob!



#8 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts
  • LocationEast Coast, USA
  • Framework Version:The Latest, of course
  • Country: Country Flag

Posted 12 October 2013 - 06:13 PM

You're very welcome John.  Let us know how it goes.



#9 John Olsson

John Olsson

    Advanced Member

  • Members

  • 43 posts
  • Framework Version:1.0.3
  • Country: Country Flag

Posted 12 October 2013 - 08:02 PM

Well, it worked fine really, however, I weren't able to include a file that was in my child-theme-folder, or any else, except for inside the Shortcode Exec PHP-plugin-folder, and that's just not the best i recon.. :) Any ideas about that?



#10 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts
  • LocationEast Coast, USA
  • Framework Version:The Latest, of course
  • Country: Country Flag

Posted 12 October 2013 - 08:05 PM

John,  are you copying your custom php file into the Shortcode Exec PHP folder?  



#11 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts
  • LocationEast Coast, USA
  • Framework Version:The Latest, of course
  • Country: Country Flag

Posted 12 October 2013 - 08:07 PM

Please tell me, step-by-step, what you did to create the shortcode?  Thanks.



#12 John Olsson

John Olsson

    Advanced Member

  • Members

  • 43 posts
  • Framework Version:1.0.3
  • Country: Country Flag

Posted 12 October 2013 - 08:11 PM

Well, it did work just to include a file, for example custum.php that i located in the same plugin-folder, but when I put the custum.php in my child-theme-folder, where it supposed to be when i'm working on it, the it just says it couldn't find the file, even that the path was correct..

 

U understand? :)



#13 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts
  • LocationEast Coast, USA
  • Framework Version:The Latest, of course
  • Country: Country Flag

Posted 12 October 2013 - 08:25 PM

John,

 

The way Shortcode Exec PHP works is you copy the PHP code from the custum.php file and paste it into the Shortcode Exec PHP screen.  See this: http://wordpress.org...hp/screenshots/

 

Where it shows you hello_world between square brackets, you're creating the shortcode name.  Where it shows you return 'Hello World'; that's where you would paste your PHP code. Not an include instruction, but the actual PHP code you have inside custum.php. 

 

Shortcode Exec PHP will write the PHP code into the WP database, allowing the shortcode to pull the PHP code from the database when you apply it to a page.



#14 Gustii

Gustii

    Newbie

  • Members
  • Pip
  • 1 posts
  • Country: Country Flag

Posted 15 October 2013 - 07:07 AM

A lot of tutorials are in internet



#15 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts
  • LocationEast Coast, USA
  • Framework Version:The Latest, of course
  • Country: Country Flag

Posted 19 October 2013 - 01:21 AM

Very true!



#16 John Olsson

John Olsson

    Advanced Member

  • Members

  • 43 posts
  • Framework Version:1.0.3
  • Country: Country Flag

Posted 19 October 2013 - 09:44 AM

OFC i know how the shortcodes work.. :)

 

But my ? is still, the easiest way to "INCLUDE" a php-page.. The code is going go be really complex and it isn't a good workflow if i'll have to copy paste in into the plugin..

 

There must be a easy way, i can't be alone to think that's a good workflow?

 

Wouldn't it be good if there was a "section" in dms where u simple "include" php-files, that would make it.. perfect.. :)



#17 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts
  • LocationEast Coast, USA
  • Framework Version:The Latest, of course
  • Country: Country Flag

Posted 19 October 2013 - 02:33 PM

John, there are PHP include plugins.  I use this one.  http://wordpress.org...ins/include-me/







Also tagged with one or more of these keywords: template