1. Internationalization / Smarty

    Date: 01/29/09     Keywords: php, html, web

    I posted this in '[info]'webdev a couple days back, but I haven't gotten any replies! Maybe you wonderful people from '[info]'php can help me. I'm working on making a website multilingual and I'm running into a tricky problem.

    The people who set up this website used Smarty, so I'm continuing to work with it. I've got the language detection code down. Pages are grouped into sections and the text for each section is stored in a config file that Smarty can read. Each page knows which section it belongs to so it knows what section of the language file to load (thus, it ignores the rest).

    The problem I'm running into is inter-paragraph links. For example:
    Lots of text with a link to another location.
    Pre-this-I18N push, the template files simply had {$rootPath}somewhere.php stored in them, with $rootPath containing the appropriate path. However, Smarty variables can't be used inside language config files like this. In general I'm unhappy about having HTML inside these files, but it's difficult not to when, for example, you only have parts of a sentence bolded. My only choice seems to be to split this into preLinkText, linkText, and postLinkText variables, but that's exceedingly kludgy.

    Have any of you worked on internationalization projects and come across this? What would you recommend to solve this issue?

    Source: http://community.livejournal.com/php/656251.html

  2. Help out a !server guy

    Date: 01/28/09     Keywords: php, web, google

    I'm not really a server type, I admit this. I have a friend who's in to all that thing, I'm more the problem solver and coder type. However he knows jack all about this stuff and Google is perplexingly repetative so I will ask here;

    Is it possible to use an extension (in this case PDFLib) to a Unix server without having access to the /ext folder or php.ini file?

    I ask this because the webhost for a guy I'm doing some construction for indicated that we could install libraries as we wanted to but I'm not seeing a lot on the FTP front for me to work with, and the Control Panel is retarded beyond belief.

    Any thoughts on what the hell they could be on about, because my limited knowledge of these matters tells me that whomever my employer talked to was quite clueless in their answer.

    Source: http://community.livejournal.com/php/655996.html

  3. RSS feeds.

    Date: 01/27/09     Keywords: rss, web

    Anyone have a good suggestion for open source/free code that will let me pull RSS feeds into a web page (in this case it is a cheap quick option to pull in news items the client posts to a Wordpress blog). Preferably code that will cache the feed locally in some manner and update it using cron, so as to minimize the response-time impact of a live feed.

    Suggestions?

    Source: http://community.livejournal.com/php/655793.html

  4. Listing alphabetically omitting "the" or "a"

    Date: 01/23/09     Keywords: php, mysql, sql

    I'm pretty sure there's a term for my title ("Listing alphabetically omitting "the" or "a"") but I'm not sure what it is.

    But that is essentially what I need...

    I use MySQL to store entries with titles. In the PHP I can populate an alphabetical list, but I'd like to go a step up and try and omit the "the" and "a" etc. So something called: "A Pen" would appear under P.

    How would I do this?

    Am I correct in thinking this will require lots of brain power? :P

    Thanks!

    Source: http://community.livejournal.com/php/655446.html

  5. Sessions

    Date: 01/17/09     Keywords: browser

    Hi Guys!

    Another one of my dumb questions! This time, it's about sessions.

    What's the best way to make a session reset itself when you hit the refresh button?


      if (!session_start())
      {
        session_start();
        header("Cache-control: private");
        $_SESSION['num'] = 0;
        $i = $_SESSION['num'];
        echo $i;
      }
      else
      {
        $i = $_SESSION['num'];
        echo $i;
      }
      
      if (!$i)
        $i = 0;
    

    (please ignore the echo's. They're what I've been using to track what the numbers are while I make this project)

    Right now, that's what I've got controlling my session for this particular thing. What happens is the value in $_SESSION['num'] increases every time the "add another item" link is clicked. A new set of fields pops up at the bottom of the form and it's filloutable. When you don't have any more things to add, you hit the submit button.

    But say I end up refreshing the page halfway through because I want to restart? Then the number doesn't reset back to 0.

    What's the best way to reset it back to zero on refresh or on the reloading of a page (without closing the browser)

    Thanks!


    Source: http://community.livejournal.com/php/654764.html

  6. Form Security

    Date: 01/15/09     Keywords: php, security, web

    Anyone have any advice for form security? I've been trying to use the advice from this page, but it doesn't seem to be working... Specifically, what happens is I get the error page and then the email shows up anyways...

    if (ereg( "[\r\n\\r\\n]", $lastname ) || ereg( "[\r\n\\r\\n]", $email ) ||ereg( "[\r\n\\r\\n]", $firstname )||empty($email) || empty($firstname) ||empty($lastname) || empty($zipcode) ) {header( "Location: error.php" );}
    else {mail( "blah@blah.com", "Website Form Request",$message, "From: $email" );header( "Location: thankyou.php" );}

    I added the \\n and \\r because that was what was displaying when I'd test with a \n in the fields. This is my first time working with a form, so I'm sure I have a lot to learn...

    Source: http://community.livejournal.com/php/653858.html

  7. Problems installing PHP on IIS

    Date: 01/15/09     Keywords: php, mysql, asp, sql

    Hello all!

    I hope it is a right community for my question.

    I have to setup a new MediaWiki site using IIS.


    The server does not have PHP and MySQL installed, so I must install it first.

    The step 1 was to install PHP.
    I've done it as described here:

    http://learn.iis.net/page.aspx/247/using-fastcgi-to-host-php-applications-on-iis-60/

    In this description the file php-cgi.exe is mentioned.

    But I've got only the file php.exe after installation.

    What could be my mistake?

    Source: http://community.livejournal.com/php/653630.html

  8. php Form Help?

    Date: 01/14/09     Keywords: php, html, web

    Hi, all. I'm trying to do my first form and am having trouble getting any of the fields to show up in the email. What I get is an email with from: "email address" subject="Website Form Request" and that's it, nothing in the content field at all. Here's what I have:

    HTML:
    <form method="post" action="sendmail.php">
    First Name:
    <input name="firstname" type="text"><br>
    Last Name:
    <input name="lastname" type="text"><br>
    Company: <input
    name="company" type="text"><BR>
    Email: <input name="email"
    type="text"><br> Phone:
    <input name="phone" type="text"><br>
    Address 1:
    <input name="address1" type="text"><br>
    Address 2:
    <input name="address2" type="text"><br>
    City: <input
    name="city" type="text"><br>
    State: <input name="state"
    type="text"><br> Zip
    Code: <input name="zipcode"
    type="text"><br> Comments:
    <br> <textarea
    name="message" rows="15" cols="40">
    </textarea><br>
    <input type="submit"> </form>

    php:
    <?php $firstname
    = $_REQUEST['firstname'];
    $lastname = $_REQUEST['lastname'];
    $company =
    $_REQUEST['company']; $email
    = $_REQUEST['email'] ;
    $phone =
    $_REQUEST['phone']; $address1
    = $_REQUEST['address1'];
    $address2 = $_REQUEST['address2'];
    $city =
    $_REQUEST['city']; $state
    = $_REQUEST['state'];
    $zipcode = $_REQUEST['zipcode'];
    $comments =
    $_REQUEST['comments']; mail(
    "taniahharrison@gmail.com", "Website Form
    Request",
    $message, "From:
    $email" );
    header( "Location: thankyou.php"
    ); ?>

    [EDIT: Fixed. Thanks!]

    Source: http://community.livejournal.com/php/653439.html

  9. setting session timeout

    Date: 01/13/09     Keywords: no keywords

    Hey guys,
    I'm undertaking a mammoth task in relation to my skill set, so my apologies if i end up posting on here a lot from now on ;)

    I am just playing about with sessions for logging in to my new site, and wanted to cover any cases of a user not logging off yet leaving the site. Currently I just have a session_start() at the top of each page, and if I leave the site, then come back to it, it keeps me logged in. But how long will that last for?

    If i use:
    session_set_cookie_params(1200);

    Would that keep a user logged in for 20 minutes regardless of whether they were active, or will it go from when they leave the site, or stop navigating? I'm really not sure of how this side of the session works :/ Ideally i'd want the session to time out after 20mins of leaving the site.

    cheers!

    paul.

    Source: http://community.livejournal.com/php/653225.html

  10. Juli's dumb question of the day

    Date: 01/12/09     Keywords: mysql, database, sql

    Hi everyone! Time for another one of my dumb questions!

    The short version: Why do my try/catch blocks not seem to catch properly?



    I'm using MySQL to update a recipe database I'm creating (and have been creating for just about forever. It's one of those projects that you can only pick up in your very limited spare time) and just for grins, I wanted to test and see if the try/catch blocks I set up to catch MySQL errors in host connection, database connection, and query running worked.

    So I changed the password to see if they would work. Let me tell you, it was a big pile of fail and MySQL errors.

    In theory, if the connection to the host is unsuccessful, it should say "Problem connecting to the host" and give the info stored in mysql_error(). But it doesn't. It just plugs along and fails like the try/catch blocks weren't even there. And I'm not quite sure why.

    So, what have I done to Eff up my Try/catch blocks?

    Example code...

    public function create_recipe()
    {
      try
      {
        $create_connect = $this->_db_connect();
        try
        {
          $this->recipe_id = $this->_set_id($create_connect, "recipes");
    
          //Selects the database from the server.
          $db_select = mysql_select_db("recipes", $create_connect);
          try
          {
            //Query to create the recipe in the database.
            $query = "INSERT INTO recipes ";
            $query .= "VALUES(" . $this->recipe_id . ", '" . 
                      $this->recipe_info["recipeName"] . "', ";
            $query .= "'" . $this->recipe_info["numServings"] . "', '" . 
                      $this->recipe_info["prepTime"] . "', ";
            $query .= "'" . $this->recipe_info["cookTime"] . "', NULL, '" . 
                      $this->recipe_info["origAuthor"] . "', ";
            $query .= "'" . $this->recipe_info["origLocation"] . "', '" . 
                      $this->recipe_info["notes"] . "', NULL);";
            //Timestamp is automatically created in the database upon insert.
            
            //Runs $query on the database.  Stops the script if there is an error.
            $result = mysql_query($query, $create_connect);
            mysql_close($create_connect);
          } //end try $eee
          catch (Exception $eee)
          {
            echo "Problem running the query. " . mysql_error($create_connect);
            echo "

    "; mysql_close($create_connect); } //end catch $eee } //end try $ee catch (Exception $ee) { //Verifies that the database/table connection was successful. If not, it kills the //application. echo "Problem selecting the table. " . mysql_error($create_connect); echo "

    "; mysql_close($create_connect); } //end catch $ee } //end try $e catch (Exception $e) { //Verifies that the connection to the host was successful. If not, it kills the //application. echo "Problem connecting to the host. " . mysql_error(); echo "

    "; } //end catch $e } //end create_recipe() private function _db_connect() { $hostname = "********"; $username = "********"; $password = "********"; return mysql_connect($hostname, $username, $password); } //end db_connect()

    Source: http://community.livejournal.com/php/652844.html

  11. Need help setting my site up with php and css

    Date: 01/12/09     Keywords: php, mysql, css, html, technology, sql, web

    I have had an html-only movie review website ( http://www.thoughtsonfilm.com/ ) for several years now and over time have grown quite tired of manually uploading articles, formatting them and the main page and manually indexing everything. I set my New Year's resolution to get the site updated to current technology both for ease of use and to add additional functionality. The problem is, I know next to nothing about MySQL, php and css. And that poses a problem.

    I have installed the ArticleMS application and think that it can adequately handle the back-end of what I'm trying to do, but I don't know enough to make it functional nor how to set up the front end to look how I want.

    So I pose the following question: Is there anyone out in internetland who can aid me in this task? The site isn't a big money maker, so I'm not going to be able to pay very much at all for the help, but if there's someone wishing to build their portfolio or who has an interest in reviewing movies, perhaps a creative compensation arrangement can be worked out.

    Source: http://community.livejournal.com/php/652635.html

  12. Help with mail code.

    Date: 01/09/09     Keywords: html, hosting, spam

    I'm experiencing massive frustration with the code I have for sending me form data. It usually works. When I test it, it always works. But now and again, it seems to just .. not work. The most recent incarnation, it sent the confirmation email (the third "mail" function), but not the first two. I have no clue what is going wrong, since it always works right when I test it.

    I've contacted the hosting company a couple of times, since at first I thought maybe it was a problem with the second address, but this last one didn't get sent to me, either.

    Any advice?


    (Email addresses change in a vain attempt to stop the spam)

            $heading="

    FOR BEP
    USE
    ONLY

    ";                           
            $today=date("d M Y");
            $datetext="

    Date of submission: $today

    ";
            $contactinfo="

    Contact information
    Contact: $contact
    Institute: $institution
    Mailing address: $address
    Telephone #: $phone
    Fax #: $fax
    Email: $email

    ";
            $projectinfo="

    Travel information
    Number of Travelers: $numtravel
    Budget: $budget
    Duration: $duration

    ";
            $abstract="

    Purpose of travel: $purpose

                    Itinerary: $itinerary

    ";
            $objects="

    BEP Objectives: $objectives

    ";
            $project=$heading.$datetext.$contactinfo.$projectinfo.$abstract.$objects;


    mail ("myemail@myplace.org","Submission: Travel & Training Application (lhilton)", "$project","From: $email\n"."MIME-Version: 1.0\n"."Content-type: text/html; charset=iso-8859-1");

    (mail ("emaillist@myplace.org","Submission: Travel & Training Application", "$project","From: $email\n"."MIME-Version: 1.0\n"."Content-type: text/html; charset=iso-8859-1");
           
            if (!empty($email)){
                mail ("$email","Confirmation of submission for Travel & Training project", "$project","From: $email\n"."MIME-Version: 1.0\n"."Content-type: text/html; charset=iso-8859-1");
            }

    Source: http://community.livejournal.com/php/652378.html

  13. a "clean" url function.

    Date: 01/09/09     Keywords: cms, google

    Hello!

    I've created a CMS which deals primarily in links.

    When someone adds a link, I also compare it to other links to see if there's a match.

    Here lies my query:

    How do I make it so every link that gets passed is "cleaned"?

    By clean, I mean something like: http://google.co.uk/ (i.e. URL normalisation-ish)

    I'm just looking to ensure that all URLs submitted follow the same "pattern," so if someone omits a www and one doesn't, then I don't get any duplicate records.

    I've tried, at the moment, a str_replace on www. and converting the link to lowercase, but I'm not sure it's entirely "functionable." If someone has www in the page name, for example...

    Much help would be appreciated, thank you!

    Source: http://community.livejournal.com/php/652115.html

  14. Working with multi arrays

    Date: 12/30/08     Keywords: no keywords

    Is there a way to tell the maximum 'depth' of nested arrays? (as opposed to how many elements are in the array, which count() returns).

    $array = array(1,2,3); // this has no nested arrays
    $array = array(array(1,2,3), array(4,5,6), array(7,8,9)); // this has several one-level nested arrays, so the max is 1.
    $array = array(array(array('xyz'),2,3), 'a', 'b'); // this has a two-level nested array - so the max is 2.

    Clear as mud? :o)

    Source: http://community.livejournal.com/php/651806.html

  15. php frameworks

    Date: 03/27/08     Keywords: php, web

    Hi,

    I am currently in the works of planning a community based website and would like to know your thoughts on php frameworks as far as extensibility, flexibility, pros, cons... you know... the usual... What do you recommend? and why.

    I currently am moving towards cakephp but would like to see if there are better ones.

    Thanks in advance.

    Source: http://community.livejournal.com/php/617145.html

  16. mail() is slow

    Date: 03/23/08     Keywords: php, spam

    I have a script that regularly sends out lots of e-mails. Like, up to 500 at once. And since I don't want to use BCC or have everyone's address in the To: field, I've been calling up the e-mail list and looping through it, using one mail() command at a time. This has proven to be very slow. Is there a more correct way to do this? I checked out some other code I've messed with, like phpbb, and they just use Bcc and "undisclosed recipients" in the To: field. I don't want to do that, it'll make the e-mails more likely to get sent to people's spam folder.

    Any other recommendations on the best way to deal with this?

    Source: http://community.livejournal.com/php/616936.html

  17. Partner

    Date: 03/23/08     Keywords: php, mysql, technology, database, asp, sql, java, web

    Hey everyone! I'm looking for a coding partner for a website I've been working on since last November. I find myself spending more time figuring out things and less time in actual development of the site--of course the learning could be rolled into the development, but it is apparent to me that more actual code needs to be written if I am to finish by my self-set deadline of the end of May.

    The server-side script is done in PHP, the site uses a MySQL database, and there is some Javascript/AJAX implemented on the client-side.

    This is probably the wrong place to find a person who has a strong background working with Javascript, but this is probably what I need more than anything since my knowledge is very limited in this area.

    I can pay something, and I am open to a payment plan based on the revenue the site generates once it is officially launched.

    A little background:

    At one time I was a full-time professional photographer... it didn't work out so well since I really couldn't find a way to bring my potential clients to neutral ground in terms of negotiations. I also networked with many photographers in Orlando and around the United States who all seemed to make the same argument and really had a problem managing the administrative side of their business--often times hiring someone else to do it for the sake of not having to deal with it.

    After completely bombing in the business in late 2006--a year after getting started, and acquring a full-time job in the technology sector, I got out of the business of actually taking the pictures, but the clients seemed to start pouring in due to the search engines ranking my current website high in returned results for folks looking for photographers in Orlando--where I'm based. There was no way that I could do the work while at the same time working my current job as a laser field service engineer--I wouldn't be in town. The solution was to help some of the photographers who I networked with out so I took care of all of the administrative work and hired them to do the actual photoshoot. We had a 40:60 [me:them] financial arrangement worked out which ultimately brought in about $20,000 last year for myself.

    With the business growing, my time becoming more and more valuable, and advice from Mr. Trump [not personally, on T.V. lol] to "think big", I decided to start the National Photographer Group, LLC, and 9photographers.com, to take the whole thing to the web by creating a somewhat self-sufficient website where photographers could, for a monthly charge, use this site to take care of their administrative business--estimates, quotes, invoices, finances, project management, and lead generation.

    As aforementioned, I started coding the site in November of 2007 and have put just about every weekend into some aspect of creating this website and business. I have already received many inquires from photographers anticipating the launch of the website.

    So, I've been stubborn, to some extent, regarding whether or not I want to have somebody else help me with this script. The last thing that I want is for my script to be snatched up and spread over the web and have the business fail because of that. The business is going to go somewhere... but I'm finding that I really can't do it alone... I need some coding help, hence this entry.

    So, if you are interested in working with me to help develop this site, or if you know someone who might be, or can point me in a direction where I can find someone who can help--preferably keeping the business in the U.S.A.-then by all means, please send a comment. Thank you for your time and sorry this was so long.

    Lance.

    Source: http://community.livejournal.com/php/616702.html

  18. Get data from a .CSV

    Date: 03/07/08     Keywords: php

    I am very new to all this btw.

    Trying to build a PHP page that reads a .CSV as a query so that a user can pick the Row data (first field is primary) and variable can be ran off of that Row.

    Does that make any sense? My brain is tired.

    Source: http://community.livejournal.com/php/616251.html

  19. Code Generators

    Date: 02/29/08     Keywords: no keywords

    (If this isn't allowed, please let me know.)

    Are there any comms for posting/sharing LJ-relevant code generators?

    I'm on the cusp of finishing one. It's very simple (and very amateur, I'm sure), but it displays moodthemes in a table, letting the user input values for title, font, and link color, as well as a theme creator link (and of course the theme folder).

    I think many theme makers might like this, but don't really know where/how to get the word out (besides posting it on my personal LJ, which has perhaps a handful of visitors).

    Many comms have very strict rules of what they do and don't allow, and I'm not exactly sure where this fits in.

    Source: http://community.livejournal.com/php/615773.html

  20. Append value to existing array key

    Date: 02/26/08     Keywords: database

    I'm trying to create an array that holds the name of the table as its key, and the field as its value. The array is populated via database output. However, the same table may be listed multiple times, since more than 1 field for each table can be present.

    However, I am having trouble appending a field to the previously created key/value pair.

    $search_array = array();
    $current_table = '';
    $result = $d->dbQuery('SELECT the_table, the_fields FROM sitesearch ORDER BY id');
    while($row = $d->dbFetchObject($result)):
    	if ($current_array != $row->the_table):
    		$search_array[$row->the_table] = $row->the_fields;
    		$current_table = $row->the_table;
    	else:
    		$search_array[${$row->the_table}] .= ','.$row->the_fields;
    	endif;
    endwhile;
    

    Source: http://community.livejournal.com/php/615163.html

Previous page  ||  Next page


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home