Jump to content

n3p3

Members
  • Posts

    14
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

n3p3's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. n3p3

    Etags

    Hi everybody, For the last few days I have been reading about Etags. In some articles they highly recommend to use Etags but in some not. So I am confused and I'll ask for your help. First, I'm using Apache server and for now one server is enough to serve my content. I've already using expire headers for images, css and js files. So my question is, should I remove Etags or configure it properly so that it works with expire headers properly? And if I'm gonna use it how do I configure it? From htaccess or from php? Cause in Yslow it says I have x misconfigured Etags. Thanks,
  2. thanks for quick response.. How can we show the numbers day by day in the last week for example?
  3. hello everyone, In my script, when a user registers I use a datetime field in db (mysql) to store registration date&time of users. What I want to do is, for my statistics module I want to show daily members count for a time period..for example, date1 - x users date2 - y users date3 - z users ... whats the best way to do this? Thanks
  4. Sorry, my mistake that I forget the last parentheses. actually what I want to do is to combine if blocks. example; $class = ($lastNotified < strtotime($timeAdded)) ?'undread':''; $class .= ($i == $count)?' last':''; echo '<li'.(!empty($class))?' class="$class"':''.'>'.$row['message'].'</li>'; but, since I've been working with more than one class I couldn't make it work. any suggestions? thank you
  5. how can i rewrite the code below in a more proffessional way. I mean avoiding repetation, using ternary operator in one line or at least two. if (($lastNotified) < strtotime($timeAdded) { if ($i == $count) { echo '<li class="unread last">'.$row['message'].'</li>'; } else { echo '<li class="unread">'.$row['message'].'</li>'; } } else { if ($i == $count) { echo '<li class="last">'.$row['message'].'</li>'; } else { echo '<li>'.$row['message'].'</li>'; } }
  6. Hello, In a web project, let's say we have a thousand users. In our algorithm, first we randomly determine a lucky user and we want to notify other users how close they're to the lucky user. Example, user_id 365 -> lucky user my user_id 360 and in my page it should say 5 user away from the lucky user.. We cannot determine it using user_id cause there may be some irregularities due to the deleted user rows. Any suggestions on how to determine the difference between lucky user and others. Thanks
  7. actually it works..a simple example (referencing the example in php.net/autoload), autoload.php <?php function __autoload($class) { require_once("$class.php"); } ?> sampleClass.php <?php class sampleClass { function __construct($value) { $this->dbvar = $value; } function getValue() { return $this->dbvar; } } ?> page1.php <?php require_once('autoload.php'); session_start(); $_SESSION['testObj'] = new sampleClass('localhost'); echo '<a href="page2.php">Go to page 2</a>'; ?> page2.php <?php require_once('autoload.php'); session_start(); echo $_SESSION['testObj']->getValue(); ?> But..When an object reference is passed to the $_SESSION, what happens to the object? If the object is still allocated in the memory, instead of creating a new object in page2.php, we can access the object by using object reference stored in our session variable..and I believe it will be a good optimization. Am I wrong?
  8. When an object reference is passed to the $_SESSION, what happens to the object? For ex, in login system, user first enters the username and password, (assuming its correct) defining the session variable as a reference to the database object like $_SESSION["db_cnn"]=&new DB(...); and accessing to db object as $_SESSION["db_cnn"]->Query(...) in other pages... is it an optimized way to use sessions in this purpose? can it be implemented to the MVC pattern? What are the advantages, and disadvantages? Thank you
  9. Why we/you use OOP instead of procedural coding while constructing the backbone of the site? In MVC pattern, we only use once this "controller" class, and also the so-called base class is actually a collection of generic functions. And derivatives of that are again adds some functions and uses some of those generic functions. So instead of creating a differen derivative of controller object everytime(where we again need to include the class' definiton file) we can simply include the needed file and call the needen function. Again in this general controller-view structure.
  10. Hello, I working on my form class and I divided it into three subsections. FormParser, FormBuilder and FormValidator.. Before I go deeply I want to ask some questions in my mind. For the form system, I decided to use xml and yaml files including all the form data. For example, sample xml file, <form id="frmNewMember" action="#" method="post"> <input type="text" name="username"> <rule minlength="3" /> </input> ... </form> FormParser class will parse the data from xml/yaml files and store it in an array. FormBuilder class will generate html forms visually using the data in array. FormValidator class will make the validation. 1) What's do you think about the system in general? This class will be a part of my future framework so I want to use xml/yaml files to seperate form views from the code. 2) Should I divide my form class into parts? (Like FormParser, FormBuilder and FormValidator) or should it be one file? 3)I don't know much about XSL and XSLT? Can it be used for the FormBuilder part? I can make some mistakes in the development process. I would be grateful, If you could show me a way to design a better system. Thank you..
  11. 448191, Could you please give an algorithm for the use of this xml configuration file with MVC. I trying to figure it out but I guess I can't.. First, for the visual representation, we need to parse this xml and generate a form in html. How we can integrate the rendered form to "view"? Then, I think we need a validate class. But if there is a failure how we can show the error messages? Thanks,
  12. redbullmarky, I have enough experience with PHP but I don't know much about OOP and Design Patterns. I developed many projects and I've seen the improvement in my coding style. Now I'm thinking a little big.. So I started with OOP. But I really don't have any idea about these design patterns.. If you can help me to start with the main idea behind MVC, I'll be glad. I'm just looking for the way to integrate modular scripts to complicated web projects. Thanks,
  13. Could you please give more but simple information about the MVC..Cause I looked at some articles in resource section, but they are too theoretic for a newbie. And can you give me some examples about the design of my CMS script..Then how can I integrate it to a website using these design patterns? Thank you
  14. Hey everybody, I'm working on a CMS script. What I want to do is, to design it as a modul. So that, I can easily integrate it to my future web projects. and I have some specific questions.. 1) which design procedure you recommend? I think I need a coding guideline for modular programming.. I'll be glad if you can give me any examples.. 2) which one is better? to create and parse xml files for content list, event list from database? or to get it as normal text?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.