Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

XC5 - including static pages content in tpl

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 09-02-2014, 02:27 AM
 
JannieB JannieB is offline
 

Senior Member
  
Join Date: Sep 2004
Posts: 117
 

Default XC5 - including static pages content in tpl

In XC4 it was easy to include the content of a static page in a tpl. This gave a lot of flexibility in providing users with a relatively friendly way of editing chunks of content, without having to worry about the layout aspects.

How do I do this in XC5?
__________________
Jan Beesley
(Currently Xcart 5
Previously XCart Gold from 3.5....)
Reply With Quote
  #2  
Old 09-02-2014, 02:31 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: XC5 - including static pages content in tpl

Please can you explain what you want to achieve? What is a static page? Do you mean a page created with SimpleCMS module? Or is it a plain content that can be stored as a new tpl? What tpl you want to insert it into? Why you want to do this?
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote
  #3  
Old 09-02-2014, 03:16 AM
 
JannieB JannieB is offline
 

Senior Member
  
Join Date: Sep 2004
Posts: 117
 

Default Re: XC5 - including static pages content in tpl

By static page .... I mean the pages in simpleCMS ... which are sort of the equivalent of the old "static pages".

Some of the content pages for the design I am working on are quite complex. In the past I have found it easier to break the different sections into different "pages" that can be edited via the wysiwyg editor. Then a page template pulls them all together. (one site where I have done this is www.scarlettjewellery.com).

I need to do something similar with the current site...

Jan
__________________
Jan Beesley
(Currently Xcart 5
Previously XCart Gold from 3.5....)
Reply With Quote
  #4  
Old 09-03-2014, 02:45 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: XC5 - including static pages content in tpl

It is possible to insert a SimpleCMS page into a template, however the code will be a bit long.

An easier way would be splitting your template into many .tpl files, and the inserting "sub-templates" with the "widget" tag:
Code:
<widget template="<template file path>"/>

Will this work for you?
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote
  #5  
Old 09-06-2014, 06:39 AM
 
JannieB JannieB is offline
 

Senior Member
  
Join Date: Sep 2004
Posts: 117
 

Default Re: XC5 - including static pages content in tpl

That's useful to know, but I don't think it will work as the key thing is for the client to be able to edit their content easily (ie. via a friendly editor).

How would I include the page contents ... presumably it is held in the database ...

Or is there another way?

Jan
__________________
Jan Beesley
(Currently Xcart 5
Previously XCart Gold from 3.5....)
Reply With Quote
  #6  
Old 09-08-2014, 10:41 PM
  xplorer's Avatar 
xplorer xplorer is offline
 

X-Cart team
  
Join Date: Jul 2004
Posts: 925
 

Default Re: XC5 - including static pages content in tpl

Here is what you can do:

1. In your custom module create a new widget class:
Code:
<?php namespace XLite\Module\[YOUR_DEV_ID]\[YOUR_MODULE_ID]\View; /** * Widget displaying a static page. */ class StaticPage extends \XLite\View\AView { /** * Widget param names */ const PARAM_PAGE_ID = 'page_id'; /** * Define widget parameters * * @return void */ protected function defineWidgetParams() { parent::defineWidgetParams(); $this->widgetParams += array( self::PARAM_PAGE_ID => new \XLite\Model\WidgetParam\Int('Static Page ID'), ); } /** * Get static page ID. * * @return integer */ protected function getPageId() { return $this->getParam(self::PARAM_PAGE_ID); } /** * Get static page. * * @return integer */ protected function getPage() { $id = $this->getPageId(); return $id ? \XLite\Core\Database::getRepo('XLite\Module\CDev\SimpleCMS\Model\Page')->find($id) : null; } /** * Return widget default template. * * @return string */ protected function getDefaultTemplate() { return 'modules/CDev/SimpleCMS/page/body.tpl'; } }

You don't need a new template file for the widget because there is a template that does the job already (so we just use it from our new widget class).

2. Now you can use this widget in your templates as follows:
Code:
... <widget class="\XLite\Module\[YOUR_DEV_ID]\[YOUR_MODULE_ID]\View\StaticPage" page_id="[STATIC_PAGE_INTERNAL_ID]" /> ...
Reply With Quote
  #7  
Old 09-09-2014, 07:51 AM
 
JannieB JannieB is offline
 

Senior Member
  
Join Date: Sep 2004
Posts: 117
 

Default Re: XC5 - including static pages content in tpl

Thank you ... I will give this a try when I get to that point ...

Jan
__________________
Jan Beesley
(Currently Xcart 5
Previously XCart Gold from 3.5....)
Reply With Quote
  #8  
Old 09-09-2014, 08:15 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Re: XC5 - including static pages content in tpl

Off-topic, JannieB Did you get my last PM?
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote
  #9  
Old 06-06-2015, 03:38 AM
 
Tomek Tomek is offline
 

Newbie
  
Join Date: May 2015
Location: Australia
Posts: 9
 

Default Re: XC5 - including static pages content in tpl

Hi, am new to widgets and have X-cart 5.2

Want to create a new simple block on the side, and insert an <iFrame> code inside the block.
Example: Google Map or a Woofu form or even just some text.


Being a beginner, is anyone able to point me to the starting point please.

Many Thanks in advance, Tom
__________________
Tom
Reply With Quote
  #10  
Old 06-08-2015, 12:39 PM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default Re: XC5 - including static pages content in tpl

Check this guide out:
http://kb.x-cart.com/display/XDD/Creating+sidebar+menu+in+customer+area
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote

The following user thanks tony_sologubov for this useful post:
Tomek (06-09-2015)
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 06:33 AM.

   

 
X-Cart forums © 2001-2020