templates

Using tinybutstrong templating system, how do I have a (secondary) mysql query (sub-block), inside another mysql query (block)?

This is the code that works well. $TBS->MergeBlock("items",$conn,"SELECT * FROM items WHERE categoryid = $getcategory"); and it has a good job of looping the items with no problem. <tr id="itemid_[items.id;block=tr]"> <td height="30"> <!-- <img src="move.png" align="left" style="margin-r...

Reducing template bloat with inheritance

Does anyone have experience reducing template code bloat using inheritance? i hesitate rewriting our containers this way: class vectorBase { public: int size(); void clear(); int m_size; void *m_rawData; //.... }; template< typename T > class vector : public vectorBase { void push_back( const T& ); //......

Is there any way to easy migrate a CSS to a joomla style classes CSS?

Hi , i'm trying to integrate a css that my designer gave me to a new template in Joomla 1.5, the problem is that the html content generate by joomla is different than the original css that the designer thought, yes it uses divs and classes and ids but i'm not sure what will be the best aproach to migrate and implement this. Is there any ...

How to inject php code from database into php script ?

I want to store php code inside my database and then use it into my script. class A { public function getName() { return "lux"; } } // instantiates a new A $a = new A(); Inside my database there is data like "hello {$a->getName()}, how are you ?" In my php code I load the data into a variable $string $string = loa...

Mapping integers to types using C++ template fails in a specific case

I am attempting to compile the following template based code in VC++ 2005. #include <iostream> using namespace std; /* * T is a template which maps an integer to a specific type. * The mapping happens through partial template specialization. * In the following T<1> is mapped to char, T<2> is mapped to long * and T<3> is mapped...

Lambda Expressions in T4 Templates

Whilst putting together a T4 template I threw in a simple lambda expression: <#=string.Join(",", updateFields.ConvertAll(field => field.Name).ToArray())#> This causes the template to fail to generate with the error: Compiling transformation: Invalid expression term '>' On the line with the lambda expression. This has been check...

Custom Wordpress Post Page Breaks if More Thank 2 Posts?

I have a very custom template, and it works great if there are 1 or 2 posts on the blog page. But as soon as a 3rd post is added, it alters the structure of the template... Literally moves a div inside of another and I can not understand why. The code for the blog template is here, and a screenshot of the structure as it should be and an...

How to fit a custom graph to the boost graph library template?

I'm rusty on C++ templates and I'm using the boost graph library (a fatal combination). I've searched the web and can't find any direct instructions on how to take a custom graph structure and fit enough of it to BGL (boost graph library) that I can use boosts graph traversing algorithms. Anyone familiar enough with the library to help m...

Specializing a template member function of a template class?

I have a template class that has a template member function that needs to be specialized, as in: template <typename T> class X { public: template <typename U> void Y() {} template <> void Y<int>() {} }; Altough VC handles this correctly, apperantly this isn't standard and GCC complains: explicit specialization in non-...

C++ template function compiles in header but not implementation

I'm trying to learn templates and I've run into this confounding error. I'm declaring some functions in a header file and I want to make a separate implementation file where the functions will be defined. Here's the code that calls the header (dum.cpp): #include <iostream> #include <vector> #include <string> #include "dumper2.h" int ...

Passing template into boost function

template <class EventType> class IEvent; class IEventable; typedef boost::function<void (IEventable&, IEvent&)> behaviorRef; What is the right way for passing template class IEvent into boost function? With this code I get: error: functional cast expression list treated as compound expression error: template argument 1 is invalid err...

GCC template issues

Possible Duplicate: problem with template inheritance This code doesn't compile in GCC: template <typename T> struct Base { public: int x; }; template <typename B> struct Middle : public B { }; template <typename T> struct Sub : public Middle<Base<T> > { public: void F() { x=1; // error: ‘x’ was not declared in this sc...

Template problems: No matching function for call

I'm trying to create a template class, and when I define a non-member template function, I get the "No matching function for call to randvec()" error. I have a template class defined as: template <class T> class Vector { T x, y, z; public: //constructors Vector(); Vector(const T& x, const T& y, const T& z); Vector(const Vector& u); /...

Babel Django Off By 1 Cent

I ran into a problem today while using BabelDjango and thought I would ask if anyone has ran into anything similar. I was using the tags in my templates, {% load babel %} and then {{amount_owed|currencyfmt:"USD"}} which returned the amount_owed minus one-cent. I thought maybe the returned value was 9.949999 which should still be $9.95 b...

How to define and use a friend function to a temlate class with the same template?

I have written the following code: #include <iostream> using namespace std; template <class T> class AA { T a; public: AA() { a = 7; } friend void print(const AA<T> & z); }; template <class T> void print(const AA<T> & z) { cout<<"Print: "<<z.a<<endl; } void main() { AA<int> a; print<int>(a); } And getting the following ...

django DateTimeField list records by day

Hay, i have a field in one of my models which saves the creation date of an object created_on = models.DateTimeField(blank=False, auto_now_add=True) This works as expected. In my templates i want to list objects like this June 15 {{ objects here which was created on June 15 }} June 14 {{ objects here which was created on June 14 }}...

What are the Rails best practices for javascript templates in restful/resourceful controllers?

First, 2 common (basic) approaches: # returning from some FoosController method respond_to do |format| # 1. render the javascript directly format.js { render :json => @foo.to_json } # 2. render the default template, say update.js.erb format.js { render } end # in update.js.erb $('#foo').html("<%= escape_javascript(render(@foo)...

Class Template Instantiation: any way round this circular reference?

I have two classes that I'm using to represent some hardware: A Button and an InputPin class which represent a button that will change the value of an IC's input pin when it's pressed down. A simple example of them is: template <int pinNumber> class InputPin { static bool IsHigh() { return ( (*portAddress) & (1<<pinNumber) ); ...

template language for ASP.NET MVC

Hi, is there any template language for ASP.NET MVC like JSTL and OGNL? Thanks in advance. ...

Codeigniter Template library, add_js() method

using This Template Library when i try and use the add_js() function it errors out. I add the regions $_scripts to the template header file but when i load the page it says undefined variable _scripts. any thoughts? changed <?= $_scripts ?> to <?= (isset($_scripts)) ? $_scripts : “”; ?> and obviously i lose the error but the js file...