Jump to content

spaze

Members
  • Posts

    29
  • Joined

  • Last visited

    Never

Everything posted by spaze

  1. Hello all! I am writing a class where you set a string to be searched and a keyword to search. I have written so far: $replacement = '<' . $this->_htmlTag . ' class="' . $this->_htmlClass . '">' . $keyword . '</' . $this->_htmlTag . '>'; $result = preg_replace("/(>|^)([^<]+)(?=<|$)/iesx","'\\1' . str_replace('" . $keyword . "', '" . $replacement . "', '\\2')", $entry); This works fine as long as the search is case sensitive, It wraps found instances if they are not inside HTML tags. I can't seem to figure out how to make case insensitive replacement and I knwo why. It's because I wrap the search keywords with html tags and not the found instances, so can someone please show me how to complete this code to replace the found instances instead of using the str_replace?
  2. Would you want to start fiddling with a code that looks like that?
  3. I was thinking about creating a simple code obuscator just to make the code look ugly. Why? Because I would like to offer my application to one company but don't want them to temper with the code. Or at least, want to make tempering a notch harder for them to do it. So I was thinking about replacing all variable names with md5() so that: $variable_name will become $c2c78403824b7735ea954cece62534cb and $this->view->variable_name will become $this->view->c2c78403824b7735ea954cece62534cb But how should I go about this? Should I do regex on the whole file and replacing everything that comes after the $ character with md5 equivalent?
  4. I use the following function to get microtime: function microtime_float() { list($usec, $sec) = explode(" ", microtime()); return ((float)$usec + (float)$sec); } How can I get date and time in microseconds?
  5. The first one works just fine, but the second one doesn't do much for the following line: <p> 9</p> It doesn't replace it with an empty one at all.
  6. I have an application to convert some HTML pages to work better on my ebook reader device. I need to replace two things: All leading and trailing spaces between opening and closing tags. Example: <p> blaa blaa</p> The other thing is I need to remove all <p></p> tags containg some number, can be with spaces or without and with line breaks. Examples: <p> 1</p> <p> 1</p> <p> 1 </p> Can someone help me with this issue as I don't seem to get it
  7. Hello, I have a response in HTML form from which I need to get data from between the <p id="myparagraph"> and </p> tags. For example: <html> <head> </head> <body> <p id="myparagraph"> sdfg dfgdfkjg dflkgj dflgkj dflgkdf g <br> dfgkjdflgkjdflgkjdflkgj </p> sdfsdfsdf sdfsdf fsdfsdf sdfsdf <p id="myparagraph"> sdfg dfgdfkjg dflkgj dflgkj dflgkdf g <br> dfgkjdflgkjdflgkjdflkgj </p> </body> </html> So what should I get is: sdfg dfgdfkjg dflkgj dflgkj dflgkdf g dfgkjdflgkjdflgkjdflkgj sdfg dfgdfkjg dflkgj dflgkj dflgkdf g dfgkjdflgkjdflgkjdflkgj basically what I am doing is creating my own custom RSS feed parser from a website that does not have RSS. All the paragraphs needed for the news content is within <p id="articleParagraph">....</p> and there can be n amount of these paragraphs per page.
  8. I created my own blog with ZF (http://www.majgaj.com/blog) and when I finished my project I realized I was missing the RSS feeds function. Since I had View and Models set, all I had to do was create rssAction() function into my controller and create new View for the actual RSS feed. All in all this RSS addition took me five minutes. If I would like to make a lighter layout for, say, mobile device, it would also take me five minutes to accomplish this. This is why I really like MVC design pattern.
  9. That is how things work on my web-hotel. if user's document_root in Apache is set to something else, these would go there ofcourse. In the installation package the Library in within the application directory, but on my web-hotel for example, the lib -directory is in a different location where multiple applications are accessing it. This also is modifiable through LIBRARY_PATH constant in main_config.php script. The reason is because on some commercial web-hotels there are no SQL databases available free-of-charge. Even though SQLite itself is usually installed in most Linux distros, the PHP might not be compiled with SQLite support for these web-hotel providers because they want to charge you for whatever database usage. This is the sole reason why I thought of adding the txtsql-db-api package to CodeFrame, to let those who don't have access to SQL database to still have the option to do SQL queries within their applications. Thanks. If nothing else, I will keep on working on this for the fun of it. I do actually use CodeFrame for many of my applications so its not at all "just for fun" project. I would love to get some people to work on this project to perhaps make yafw, yet another framework
  10. I created a Subversion repository in Google Codes, so that people can look at the source code before downloading. http://code.google.com/p/codeframe/source/browse/#svn/trunk
  11. I see your point Perhaps the configuration of BASE_URL is not so complicated after all. Thanks for your help!
  12. Hello, I would like to know what people here think about a framework I wrote. http://www.majgaj.com/codeframe This project was born some time ago and now I got inspiration to continue on this. Please have a look at the project and tell me your thoughts on it. Thanks!
  13. Thanks for your reply. I have done this already and current version does just this, but since the user needs to configure the application by having to know the base I was hoping to find a way to automize this. It would be neat to find the base_uri from which the script is running so that I could replace the URI portion of this base_uri with blank.
  14. Since I don't quite get what you trying to say, can you lead me a little toward the right direction?
  15. I do have BASE_DIR parameter that only shows where the controllers are located, but this won't help me get the requested controller name from the URL.
  16. Can I do this from the PHP or do I have to modify the .htaccess file?
  17. Hello all, I am writing my own framework and stumbled upon a problem. I want to determine controller and action from the given URL. So far I have been using the URI to fetch the first and second section from the URI, but this is limited to having the application and domain root (www.domain.com) If I would have my framework in sub-directories, ie. www.domain.com/sub1/sub2/sub3, and then call index/show, the first section I would fetch would be sub1 and second sub2 How can I effectively code this so that I would always get the index and show from www.domain.com/sub1/sub2/sub3/index/show even if I would have more sections after this? What I'm tryng to say is, how can I dynamically fetch these two like so: www.domain.com/index/show -> URI = index/show www.domain.com/sub1/sub2/sub3/index/show/param1/param2 -> URI = index/show Currently the latter returns sub1/sub2/sub3/index/show/param1/param2 and this is not what I need.
  18. I have a bootstrap file called index.php for a Zend Framework project. How can I get in that script the URL of the index.php? For example, if I run my Zend Framework app at http://www.mydomain.com/myapp it will call the index.php bootsrtap in it. If I enter http://www.mydomain.com/myapp/user/login, I would like to figure out how to get the "http://www.mydomain.com/myapp" returned as this essentially is the location of the bootsrap file called despite what the requested URI is. Anyone have an idea?
  19. Added some documentation with visual aid to help you understand what I have done so far.
  20. I just managed to create the website for this project, you are more than welcome to have a look! CodeFrame PHP Framework - Homepage In case you want to know, this site is done with CodeFrame Some of the pages don't have content yet, but the framework will inform you of which of the functions don't work. Please register in order to get a download package both for Linux and Windows.
  21. Forgot to mention that the framwork would be VMC based.
  22. Hello! I'm working on my own framework and were wondering if there are any of you out there that would be interested in joining me in creating a framework? Why another framework? I think in creating a framework you can learn a lot and while there are many good frameworks out there it would be neat to have something that is truly your code and available to others. I bet ZF started this way as well and it has grown huge. Besides, having such a merit of being a developer for a framework is a bonus credit in your CV, don't you think? I have a website almost ready for the project as well as forum for the developers. I also have the base of the framework done, but I would like to make it better and have a group of people working on it as well. So lets hear from you that are interested. If you really have the will to create a framework that you can use in your projects and want to pitch in, send me an email to info[at]majgaj.com
  23. For the first link, put parameters the each link as follows: show.php?min=1&max=10 show.php?min=11&max=20 show.php?min=21&max=30 show.php?min=31&max=40 show.php?min=41&max=50 Then in your script, when you fetch the data from the database or text file, ignore all that comes before min and after max values and show the not-ignored values on your website. This means each time you click on a link it makes a new data query.
  24. Hello all, I am working on my own framework for certain reasons and just wanted to know what is the best way to split given URL into an array from which I would build the function. So far I have: $service_dirs = explode('/', $_SERVER["REQUEST_URI"]); $controller, $action, $obj = ''; if ($service_dirs) { if ( $service_dirs[2] ) { $controller = $service_dirs[2]; } if ( $service_dirs[3] ) { $action = $service_dirs[3]; } if ( $service_dirs[4] ) { $obj = $service_dirs[4]; } } What would be a better approach to this. I have a bootstrap file index.php to which all traffic is directed. Then the index.php calls for certain controllers based on the given URL: www.mydomain.com/view/user/1234 In the above example I would call the view controller and userAction with userid 1234.
×
×
  • 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.