Jump to content

eevan79

Members
  • Posts

    240
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://dota.iz.rs

Profile Information

  • Gender
    Male
  • Location
    Belgrade, Serbia

eevan79's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. I already tried with DOM but without success. Maybe I need to look deeper... Also I found an interesting jQuery plugin, and maybe it can be usefull: http://benalman.com/code/projects/jquery-replacetext/examples/replacetext/ It replace all text but leave all tags and attributes untouched.
  2. I want to replace latin text to cirilic text. It's not so hard, but there is problem with HTML. It's also replaced. Example: $before = array("a","b","c","d"); //etc. $after = array("а","б","ц","д"); //etc. //final output *original: some text <a href="link"><img src="image" alt /></a> //final output *after: соме техт <а хреф="линк"><имг срц="имаге" алт /></а> How to replace all text but ignore HTML (not remove) ?
  3. @PFMaBiSmAd, finally solved. I activated Show All Characters and it shows CR *without LF, so I converted it Win format. Thanks.
  4. It is very strange because it never has happened. Perhaps with the new version of the program. I use Notepad++ and was looking at all options regarding text wrapping and margin boundary but any change has no effect. Still do not understand why file is saved differently - when I view page source it's all wrapped and I want to be same as I wrote. Has to do with settings options of code editor?
  5. I'm not sure that this issue belongs to this forum because of problems that do not understand. I do not know why this happens. When I look at the page source code is wrapped without spaces. It look like this: And here is source code: I know that this is not a big problem, but can be irritating, especially when looking at the page source for debugging and so on. This did not happen earlier. Does anyone know why this happens?
  6. Because, there are lots of (already) linked articles in other articles. However, I solve this and all links from Wordpress are valid (rewrited with title=LINK).
  7. Thanks. With few corrections it's working fine. $categoryFile = dirname($_SERVER['SCRIPT_FILENAME'])."/inc/cat_ids.php"; $categoryList = array(); foreach( file($categoryFile) as $line) { preg_match("#(\d+)='([^']*)'#", $line, $match); $categoryList[$match[1]] = str_replace("-", " ", $match[2]); } //$categories = $category; 1,5,23,46 $categoryIDsAry = array_map('trim', explode("," , $category)); $catsHTMLAry = array(); foreach ($categoryIDsAry as $catID) { $catSlug = $categoryList[$catID]; $catName = str_replace("-", " ", $catSlug); $catsHTMLAry[] = "<a href=\"index.php?category=$catSlug\">".strtoupper($catName)."</a> "; } $cats = implode(', ', $catsHTMLAry);
  8. Here is how I get categories for article listing. Article can be written in several categories at once. So I have this code: $category = '1,5,23,46'; //Category IDs $get_cats = explode("," , $category); $cats = ""; for ($i = 0; $i<count($get_cats); $i++ ) { $cat = trim($get_cats[$i]); $catSlug = get_value_of($cat, "inc/cat_ids.php"); $catName = str_replace("-"," ",$catSlug); $cats .= "<a href=\"index.php?category=$catSlug\">".strtoupper($catName)."</a>, "; } $cats = substr($cats,0,-2); As you can see there's get_value_of function that is used to read the category from the file. File is cat_ids.php and looks like this: I want to improve this in order not to read the file at each step ("for" loop). Means, one can load the file and then generate a list of (links) category compared to the numbers (Ids). So if $category is "1,3,4" I want to get list like this (by reading cat_ids.php): category-name-1, category name-3, category-name-4 With current function I read value for every ID from file in every step. So if article have 10 or more categories script load file 10 or more times. Looking for a solution to do this from a reading file only once. Thanks.
  9. I forgot to include code. This is what I have tried (on localhost): RewriteEngine On RewriteBase /wp/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([a-zA-Z0-9-]+)$ wp/index.php?title=$1 [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /wp/index.php [L] So if i have link like this: http://localhost/wp/test I got: title=test. But if I have more "/" or slash on the end of url I get page with wrong links (including .css etc). I just need to get "text" after last trailing slash and rewrite to title=?
  10. I try to integrate WordPress perm links into new cms (custom), so I need to make rewrite condition for old links in posts. So I have links like this: site.com/category/page-title or site.com/category/page-title/ site.com/games/text/page-title or site.com/games/text/page-title/ etc. I need to get last request uri ( url after last "/" ) and rewrite to: site.com/index.php?title=page-title I have tried various methods but nothing do not succeed.
  11. Google cant see pages with rewrite mod. Always return 404 (not found). So if my page is: site.com/page/20.html google return 404 but if page is site.com/?page&title=20 it's working fine. Why google can't index pages with rewrite mod? Here is my .htaccess RewriteRule title/(.*)\.html$ /?page&title=$1
  12. I have field "friends" 0/1 for accepted requests. @kickstart, tested and working fine. Thats query I looking for.
  13. I have USERS table and FRIENDS table. When user send friend request to other user data have been added into FRIENDS table. When other user accept request, data is also added (for his ID). There's no problem to get approved (both data) friends, but I want to get pending list. This is fields for FRIENDS table: user_id | friend_id | friends For example we have 2 users: one with ID 1, and other with ID 2. So user with ID 1 send friend request to ID 2 following data will be added into FRIENDS table: 1 | 2 | 1 When other user accept request: 2 | 1 | 1 So there is record for both users in FRIENDS table. So, how to get data only when there is one record (to get pending requests)? This is query to get friend list: SELECT z.friend_id, u.username, u.user_avatar FROM " . FRIENDS_TABLE . " AS z, " . FRIENDS_TABLE . " AS m, " . USERS_TABLE . " AS u WHERE z.friend_id= m.user_id AND m.friend_id= {$userID} AND z.user_id = {$userID} AND z.friend_id= u.user_id ORDER BY LOWER(u.username) DESC Now I need query to get pending request (those that the user has not yet approved)? [/size]
  14. I already use authentication, but I don't want to registered user access the file directly. Maybe I can use $_SERVER['HTTP_REFERER'] to check if file is called from website, instead directly. If user calls the file directly, $_SERVER['HTTP_REFERER'] will be empty. But I think that this is not enough ...
  15. I use jQuery when adding messages. However, the file can be called directly. For example: includes/add_comment.php?id=2 So, I can make a form and call this file directly to add a message. ID is user id and form can be submited with HTML form wherever are located. How to prevent direct access to the file when called through a Ajax?
×
×
  • 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.