Re: [PHPTAL] Paths to resources in templates

2011-11-04 Thread Levi Stanley
Hi

You dream solution, is the solution that I implemented.  However, I don't
use phpquery, I used simple_html_dom (I like how it feels like jquery).  As
you mentioned css url's do not change, I am looking into a possible
solution to this.

Thank you for the phpquery reference, looks promising.

Best regards,
Levi Stanley

On Fri, Nov 4, 2011 at 9:26 AM, adobebi...@gmail.com
wrote:

> Hi,
>
> I have been thinking for months on this issue and tried several things,
>
> One is within codeigniter, creating an assetmanager controller class and
> use its action to navigate the design time url to runtime url ... The code
> is most bottom of this message. And note that I didn't like and use it,
> because it uses ugly redirect command for each url, but in theori it is
> working.
>
> Other theory is using server shortcuts for runtime url access. It is
> better than using redirect command but it needs server configuration, and
> not an ellastic solution especially you need to create multiple template
> based projects require new templates and assets folder dymamicly created
> continously...
>
> The last trick which I so far desided to use is using ${imagepath} as the
> forlder name. So in design time, or while opening directly template html
> file, for example an image tag
> . In windows, I can make my image
> assets folder name as ${imagepath} and it works in linux server... This
> always works except dreamweaver design time for in css files like this
> example definition   .style1 { background:url(${imagepath}/image1.png)}
> because of the braces inside braces.
>
> Above them are still ugly solutions for me.
>
> What I dreamed soluiton is that, enhancing phptal dom capability to read
> the attrybute values in templates and to set them for runtime working. So
> that our desing time url, special-folder-name-for-assets in  src="special-folder-name-for-assets/icons/ico.png"> will output like
> "application/views/special-folder-name-for-assets/icons/ico.png". Yet, this
> does not solver urls in css files. But does a lot of ugly work as well as
> other dom operations. It would be very nice if enhancing phptals dom
> capability using phpquery .
>
>
> #Apache Configuration
> 
>   ServerName 
>   DocumentRoot "..."
>   DirectoryIndex index.php
>   
>   *Alias /images
> C:\wamp\www\socialdoctorpages\subwork\testci\application\views\images*
> 
>
> //Assetmanager Class
> class Assetmanager extends Controller {
> function __construct() {
> parent::__construct();
> $this->load->library('Tal');
> //prepare global page tal data
>  $this->tal->base_url = base_url(); //'${base_url}';
> $this->tal->tpl_path = $this->tal->template_repository;
>  $this->tal->assets  =  $this->tal->template_repository . '/${assets}';
> //'${assets}';
>  $this->tal->tpl_full_path = base_url() . $this->tal->template_repository
> . '/';
> $this->tal->globalpage = 'layout_main.html/globalpage';
>  }
>
>   function template_assets($path) {
> //echo $path . '';
>  //echo $this->uri->uri_string . '';
> //echo $this->uri->ruri_string() . '';
>  $target = $this->tal->template_repository . $this->uri->uri_string;
>  //echo $target;
> redirect($target);
>  //header('Content-Type: image/jpeg');
> //echo file_get_contents($target);
>  }
>  function global_assets($path) {
>  echo 'Target file not found: ' . $this->uri->uri_string;
>  //print_r('application/views/default' . $this->uri->uri_string());
> //redirect('application/views/default' . $this->uri->uri_string());
>  //header('Content-Type: image/jpeg');
> //echo file_get_contents('application/views/default' .
> $this->uri->uri_string());
>  //redirect('application/views/default' . $this->uri->uri_string());
>  }
> }
>
>
>
> On Thu, Nov 3, 2011 at 10:00 AM, romtek  wrote:
>
>> Hi,
>>
>> The nature of the development approach that I use is that paths to
>> resources (images, CSS and JS files, etc.) relative to the template files
>> during design time are different from those during run time. (I have
>> templates in a separate folder, but my web app runs as index.php in the
>> root folder.)
>>
>> I like to see preview of a page I work on in Design view of Expression
>> Web or Dreamweaver, and so in order to have images, etc. point to proper
>> paths during design time and also during run time, I do something like this
>> in my templates:
>>
>> > src="../../resources/shared/images/menu_bar.jpg" />
>>
>> This increases workload, makes code less readable, and is error prone
>> during modifications.
>>
>> How do you, guys, deal with this issue, if you do? Maybe there's a trick
>> that I haven't thought of. I've tried using  element, but Dreamweaver
>> ignores it, and Expression Web messes up my code. By the way, this problem
>> isn't limited to those who use PHPTAL but, apparently, is also shared by
>> some of those who Code Igniter (and, I am sure, other frameworks that
>> require a structure of folders):
>> http://codeigniter.com/forums/viewt

Re: [PHPTAL] Paths to resources in templates

2011-11-04 Thread adobebi...@gmail.com
Hi,

I have been thinking for months on this issue and tried several things,

One is within codeigniter, creating an assetmanager controller class and
use its action to navigate the design time url to runtime url ... The code
is most bottom of this message. And note that I didn't like and use it,
because it uses ugly redirect command for each url, but in theori it is
working.

Other theory is using server shortcuts for runtime url access. It is better
than using redirect command but it needs server configuration, and not an
ellastic solution especially you need to create multiple template based
projects require new templates and assets folder dymamicly created
continously...

The last trick which I so far desided to use is using ${imagepath} as the
forlder name. So in design time, or while opening directly template html
file, for example an image tag
. In windows, I can make my image assets
folder name as ${imagepath} and it works in linux server... This always
works except dreamweaver design time for in css files like this example
definition   .style1 { background:url(${imagepath}/image1.png)} because of
the braces inside braces.

Above them are still ugly solutions for me.

What I dreamed soluiton is that, enhancing phptal dom capability to read
the attrybute values in templates and to set them for runtime working. So
that our desing time url, special-folder-name-for-assets in  will output like
"application/views/special-folder-name-for-assets/icons/ico.png". Yet, this
does not solver urls in css files. But does a lot of ugly work as well as
other dom operations. It would be very nice if enhancing phptals dom
capability using phpquery .


#Apache Configuration

  ServerName 
  DocumentRoot "..."
  DirectoryIndex index.php
  
  *Alias /images
C:\wamp\www\socialdoctorpages\subwork\testci\application\views\images*


//Assetmanager Class
class Assetmanager extends Controller {
function __construct() {
parent::__construct();
$this->load->library('Tal');
//prepare global page tal data
$this->tal->base_url = base_url(); //'${base_url}';
$this->tal->tpl_path = $this->tal->template_repository;
$this->tal->assets  =  $this->tal->template_repository . '/${assets}';
//'${assets}';
$this->tal->tpl_full_path = base_url() . $this->tal->template_repository .
'/';
$this->tal->globalpage = 'layout_main.html/globalpage';
}

 function template_assets($path) {
//echo $path . '';
//echo $this->uri->uri_string . '';
//echo $this->uri->ruri_string() . '';
 $target = $this->tal->template_repository . $this->uri->uri_string;
//echo $target;
redirect($target);
 //header('Content-Type: image/jpeg');
//echo file_get_contents($target);
}
 function global_assets($path) {
echo 'Target file not found: ' . $this->uri->uri_string;
 //print_r('application/views/default' . $this->uri->uri_string());
//redirect('application/views/default' . $this->uri->uri_string());
//header('Content-Type: image/jpeg');
//echo file_get_contents('application/views/default' .
$this->uri->uri_string());
//redirect('application/views/default' . $this->uri->uri_string());
}
}



On Thu, Nov 3, 2011 at 10:00 AM, romtek  wrote:

> Hi,
>
> The nature of the development approach that I use is that paths to
> resources (images, CSS and JS files, etc.) relative to the template files
> during design time are different from those during run time. (I have
> templates in a separate folder, but my web app runs as index.php in the
> root folder.)
>
> I like to see preview of a page I work on in Design view of Expression Web
> or Dreamweaver, and so in order to have images, etc. point to proper paths
> during design time and also during run time, I do something like this in my
> templates:
>
>  src="../../resources/shared/images/menu_bar.jpg" />
>
> This increases workload, makes code less readable, and is error prone
> during modifications.
>
> How do you, guys, deal with this issue, if you do? Maybe there's a trick
> that I haven't thought of. I've tried using  element, but Dreamweaver
> ignores it, and Expression Web messes up my code. By the way, this problem
> isn't limited to those who use PHPTAL but, apparently, is also shared by
> some of those who Code Igniter (and, I am sure, other frameworks that
> require a structure of folders):
> http://codeigniter.com/forums/viewthread/94591/#478998
>
> Roman
>
> ___
> PHPTAL mailing list
> PHPTAL@lists.motion-twin.com
> http://lists.motion-twin.com/mailman/listinfo/phptal
>
>
___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: [PHPTAL] Paths to resources in templates

2011-11-04 Thread Levi Stanley

Roman:

We try to leave everything we get from design as close as possible to 
the way they gave it to us.  We laid down some ground rules for design, 
everything their html uses must be put in flash, images, css, js, and  
fonts directories.  I have also gotten them into designing layouts and 
views, so I no longer have to split them up for my framework.  I then 
implement a pre-filter which will allow me to dictate the location in my 
system so I can basically put the resources anywhere I want.


What this ends up doing:

  1. You no longer have to go into every template and edit it as much,
 and allows you to focus on the presentation logic more.
  2. Also it kind of forces the designer to think about where to put
 things, because we were getting javascript libraries laying around
 -- outside of the js directory for no reason at all.
  3. It allows you to implement different skins for your site easily.
  4. Also now design can download the html and work on it, the source
 still has "images/, "css/, "js/, so their design software will
 still work, and show the images.
  5. And you don't have the problem of forgetting to remove stuff for
 production.

I hope this has helped you out.

Best regards,
Levi Stanley

On 11/03/11 04:00, romtek wrote:

Hi,

The nature of the development approach that I use is that paths to 
resources (images, CSS and JS files, etc.) relative to the template 
files during design time are different from those during run time. (I 
have templates in a separate folder, but my web app runs as index.php 
in the root folder.)


I like to see preview of a page I work on in Design view of Expression 
Web or Dreamweaver, and so in order to have images, etc. point to 
proper paths during design time and also during run time, I do 
something like this in my templates:


src="../../resources/shared/images/menu_bar.jpg" />


This increases workload, makes code less readable, and is error prone 
during modifications.


How do you, guys, deal with this issue, if you do? Maybe there's a 
trick that I haven't thought of. I've tried using  element, but 
Dreamweaver ignores it, and Expression Web messes up my code. By the 
way, this problem isn't limited to those who use PHPTAL but, 
apparently, is also shared by some of those who Code Igniter (and, I 
am sure, other frameworks that require a structure of folders): 
http://codeigniter.com/forums/viewthread/94591/#478998


Roman


___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: [PHPTAL] Paths to resources in templates

2011-11-03 Thread romtek
That is great! I've had this idea before and even read about symbolic links
but didn't get it well enough, but after your reply I've reread about them
and tried them out and gotten exactly what I needed. Thank you very much,
Darrell!


On Thu, Nov 3, 2011 at 11:23 AM, Darrell Hamilton wrote:

> Depending on your environment, you could simply symlink the
> directories you use for development to where the files will eventually
> be stored, or if you have control of the webserver configuration, (and
> you're using apache) there's always mod_rewrite.
>
> Darrell Hamilton,
> Software Developer,
> 4over, Inc
> darre...@4over.com
> 818-246-1170 ext. 285
>
>
>
> On Thu, Nov 3, 2011 at 1:00 AM, romtek  wrote:
> > Hi,
> >
> > The nature of the development approach that I use is that paths to
> resources
> > (images, CSS and JS files, etc.) relative to the template files during
> > design time are different from those during run time. (I have templates
> in a
> > separate folder, but my web app runs as index.php in the root folder.)
> >
> > I like to see preview of a page I work on in Design view of Expression
> Web
> > or Dreamweaver, and so in order to have images, etc. point to proper
> paths
> > during design time and also during run time, I do something like this in
> my
> > templates:
> >
> >  > src="../../resources/shared/images/menu_bar.jpg" />
> >
> > This increases workload, makes code less readable, and is error prone
> during
> > modifications.
> >
> > How do you, guys, deal with this issue, if you do? Maybe there's a trick
> > that I haven't thought of. I've tried using  element, but
> Dreamweaver
> > ignores it, and Expression Web messes up my code. By the way, this
> problem
> > isn't limited to those who use PHPTAL but, apparently, is also shared by
> > some of those who Code Igniter (and, I am sure, other frameworks that
> > require a structure of folders):
> > http://codeigniter.com/forums/viewthread/94591/#478998
> >
> > Roman
> >
>
>
___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: [PHPTAL] Paths to resources in templates

2011-11-03 Thread Darrell Hamilton
Depending on your environment, you could simply symlink the
directories you use for development to where the files will eventually
be stored, or if you have control of the webserver configuration, (and
you're using apache) there's always mod_rewrite.

Darrell Hamilton,
Software Developer,
4over, Inc
darre...@4over.com
818-246-1170 ext. 285



On Thu, Nov 3, 2011 at 1:00 AM, romtek  wrote:
> Hi,
>
> The nature of the development approach that I use is that paths to resources
> (images, CSS and JS files, etc.) relative to the template files during
> design time are different from those during run time. (I have templates in a
> separate folder, but my web app runs as index.php in the root folder.)
>
> I like to see preview of a page I work on in Design view of Expression Web
> or Dreamweaver, and so in order to have images, etc. point to proper paths
> during design time and also during run time, I do something like this in my
> templates:
>
>  src="../../resources/shared/images/menu_bar.jpg" />
>
> This increases workload, makes code less readable, and is error prone during
> modifications.
>
> How do you, guys, deal with this issue, if you do? Maybe there's a trick
> that I haven't thought of. I've tried using  element, but Dreamweaver
> ignores it, and Expression Web messes up my code. By the way, this problem
> isn't limited to those who use PHPTAL but, apparently, is also shared by
> some of those who Code Igniter (and, I am sure, other frameworks that
> require a structure of folders):
> http://codeigniter.com/forums/viewthread/94591/#478998
>
> Roman
>
> ___
> PHPTAL mailing list
> PHPTAL@lists.motion-twin.com
> http://lists.motion-twin.com/mailman/listinfo/phptal
>
>

___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


[PHPTAL] Paths to resources in templates

2011-11-03 Thread romtek
Hi,

The nature of the development approach that I use is that paths to
resources (images, CSS and JS files, etc.) relative to the template files
during design time are different from those during run time. (I have
templates in a separate folder, but my web app runs as index.php in the
root folder.)

I like to see preview of a page I work on in Design view of Expression Web
or Dreamweaver, and so in order to have images, etc. point to proper paths
during design time and also during run time, I do something like this in my
templates:



This increases workload, makes code less readable, and is error prone
during modifications.

How do you, guys, deal with this issue, if you do? Maybe there's a trick
that I haven't thought of. I've tried using  element, but Dreamweaver
ignores it, and Expression Web messes up my code. By the way, this problem
isn't limited to those who use PHPTAL but, apparently, is also shared by
some of those who Code Igniter (and, I am sure, other frameworks that
require a structure of folders):
http://codeigniter.com/forums/viewthread/94591/#478998

Roman
___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal