Jump to content

bjenn85

New Members
  • Posts

    5
  • Joined

  • Last visited

bjenn85's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I have a function I call to check if the title of a post is too long as a backup to maxlength on the form. I am now trying to add a simple check and stop the submission if it is in caps. I am just simply looking for the abscence of any lowercase letters, nothing complicated. Here is my snippet below but it's not working I always get the caps error even if the title isn't all caps. What am I doing wrong? Sorry I'm a little new to PHP. function checktitle($title){ if(strlen($title)>55) return getmsg('Title Is Too Long'); if(!preg_match('/[a-z]/',$title)); return getmsg('Title Is All Caps');}
  2. I got it figured out using http://php.net/manual/en/function.nl2br.php $txt=str_replace(array("\r\n","\r","\n"),"<br>",$txt); return $txt;}
  3. I am trying to figure out why my page is not loading correctly with viewport. I am using: <meta name="viewport" content="device-width,initial-scale=1"> I have a 750px wide div wrap around my website and to be clear my website shows perfect with this: <meta name="viewport" content="770,initial-scale=0.8"> The problem there is font boosting on mobile browsers screws up my paragraphs, the first viewport is the only way to solve this. The problem with the first viewport is that it cuts off the right side of the page and there is no margin which makes clicking pagination links and other items hard. See pictures: Above left side margin is fine. Here you see the right side margin whitespacing is nonexistent. Can anyone help me with this? Below are my body and wrap CSS body{background-color:#FFF} .wrap{width:750px;margin:20px auto;margin-bottom:0}
  4. I have a simple bulletin board I'm working on and would to run all of my HTML inline for performance and/or OCD. Right now if I submit a message with multiple lines by hitting Enter and then you view the page source it breaks it up into several lines... example: I would like it to run those <br>'s inline with the rest of the source code instead of making a new line, but I'm having trouble figuring it out. I'm using this snippet below to find Enter spaces/new lines with "\n" and then using a <br> in place: function fixtabspa( $txt ) { $srch = array( "\n", "\t", ' ', ' ' ); $replc = array( '<br>', ' ', ' ', ' ' ); return str_replace( $srch, $replc, $txt ); } and on the posting form we call that function simply: $post_message = fixtabspa( $post_message ); Any clue on how to replace those \n's with <br>'s without making new lines in the source code? Thanks
  5. function format_bbcode( $text ) { $search = array( '#\[url=(http|https|ftp)://(.+?)\](.+?)\[/url\]#ie', '#\[url\](http|https|ftp)://(.+?)\[/url\]#ie' ); $replace = array( 'trunc_url(\'\\1://\\2\',\'\\3\')', 'trunc_url(\'\\1://\\2\',\'\\1://\\2\')' ); return preg_replace( $search, $replace, $text ); } function make_urls( $text ) { $search = array( '#(^|\s)(http|https|ftp)(://[^\s\[]+)#i' ); $replace = array( '\\1[url]\\2\\3[/url]' ); return preg_replace( $search, $replace, $text ); } old tiny forum I use and since the latest PHP upgrade I've been building up a huge error_log for deprecated preg_replace can someone please show me how to use preg_replace_callback on these two?
×
×
  • 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.