Solved

Customized content at load time...Django? Or is there something better?

Posted on 2013-06-24
12
325 Views
Last Modified: 2013-07-01
So, YEEEARS ago I worked on a project that used PHP to customize the appearance of a web page based on volatile information. We had snippets of functions with pieces of HTML code in them loosely in the format of...

function starttable(){
echo '<table>';
}

function endtable(){
      echo "</table>"
}

function startcol(){
echo '<td>';
}

function endcol(){
echo '</td>';
}

function addimage(){
...yadda;
}

...ad nauseum. By using these snippets in conjunction with what was appearing in a database (if there was new data, make a table for it, if not don't) we were able to completely customize the layout and look of a webpage at load time.

The key being that there was not predefined format. Instead the code determined the shape of each page individually at runtime.

But the code was cumbersome and nightmarish.

I am assuming these is something out there that is better than this now. Django perhaps? Something else?

Does anyone have an suggestions/tutorials/ideas?

OH...P.s. It need to run on a linux/apache config :-)

Thanks!
0
Comment
Question by:Mike R.
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 2
12 Comments
 
LVL 58

Expert Comment

by:Gary
ID: 39271846
lol
So you called a function to just write <table>
You just write the HTML in a loop

if (condition1=1){
    echo "<table">
    foreach ($x as $y){
        echo "<tr><td>".$y."</td></tr>";
    }
    echo "</table">
}

Open in new window

0
 
LVL 3

Author Comment

by:Mike R.
ID: 39273918
Hey Gary,

Thanks for the input. :-) Well, that wasn't exactly the code, it was just an example I pulled off the top of my head to make it clear what I was saying.

But it kind of wasn't really what I was asking.

My question is; I don't want to do anything in PHP because it's cumbersome and bulky. I was wondering what other frameworks are out there for responsize page design and/or on-the-fly modifications to a page payout that can do this in a far more streamlined manner than punching out a ton of PHP.

I've looked into CSS Grid Framework, Django...are there others?

Thanks!
0
 
LVL 3

Author Comment

by:Mike R.
ID: 39273930
But, honestly, don't you think think the following is a boatload cleaner, more readable, and more reusable? ...

if (condition1=1){
    starttable();
    foreach ($x as $y){
	startcol();
        startrow(); 
		echo ".$y."
	endrow(); 
	endcol();
    }
    endtable();
}

Open in new window

0
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 39274789
Not really
http://www.tuxradar.com/practicalphp/18/1/3

Depending on your site have a look at Wordpress or Drupal - no coding involved.
0
 
LVL 3

Author Comment

by:Mike R.
ID: 39275045
Ya...that's part of the reason I'm trying to dump php altogether.
0
 
LVL 3

Author Comment

by:Mike R.
ID: 39282070
I've requested that this question be deleted for the following reason:

Only one response.

(Edit: Off-topic remark removed - Modulus_Twelve)
0
 
LVL 3

Author Comment

by:Mike R.
ID: 39282245
I apologize. I did not know the comment would be visible. Nonetheless, the commenter has not been addressing the actual question, directing me to information built on the platform I was trying to get away from, and making recommendations that don't apply. His tone also was unhelpful and condescending.

Because there have been no other responders, I think its just best to close the question.
0
 
LVL 3

Author Comment

by:Mike R.
ID: 39287038
I've requested that this question be closed as follows:

Accepted answer: 0 points for rightmirem's comment #a39282070

for the following reason:

No other solution was provided
0
 
LVL 3

Author Comment

by:Mike R.
ID: 39287125
Ive been trying to delete the question.
0
 
LVL 3

Author Comment

by:Mike R.
ID: 39287154
I apologize for my breach of etiquette and have accepted a solution.
0

Featured Post

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question