Jump to content

drilonb

Members
  • Posts

    99
  • Joined

  • Last visited

Everything posted by drilonb

  1. Yes i know for it but the problem is like this i like to know, ok i will comment classes <?php function treeMenu(Page $page = null, Page $rootPage = null, $id = null) { if(is_null($page)) $page = wire('page'); if(is_null($rootPage)) $rootPage = wire('pages')->get('/'); if(!is_null($id)) $id = " id='$id'"; $out = "\n<ul$id>"; $parents = $page->parents; // This is where we get pages we want. You could just say template!=news-item foreach($rootPage->children('template!=post, template!=faq-item, template!=gallery') as $child) { $class = "level-" . count($child->parents); // for what is this class $s = ''; // for what is this if($child->numChildren && $parents->has($child)) { $class .= " on on_path"; // for what is this class $s = str_replace("\n", "\n\t\t", treeMenu($page, $child)); } else if($child === $page) { $class .= " on on_page"; if($page->numChildren) $s = str_replace("\n", "\n\t\t", treeMenu($page, $page)); } $class .= " page-{$child->id}"; $class = " class='$class'"; // for what is this class $out .= "\n\t<li$class>\n\t\t<a$class href='{$child->url}'>{$child->title}</a>$s\n\t</li>"; } $out .= "\n</ul>"; return $out; }
  2. mmm look this is a menu in process wire Pages and Children Home Service Delta Alfa Tango Help Tech Marketing Analytic About Contact another demo here http://www.sohtanaka.com/web-design/examples/drop-down-menu/ http://www.cssplay.co.uk/menus/dd_valid.html i just like to make drop down menu i try to make it with your suggestions and apesia but i am confuse with class where to add or how they are added in code. <?php function treeMenu(Page $page = null, Page $rootPage = null, $id = null) { if(is_null($page)) $page = wire('page'); if(is_null($rootPage)) $rootPage = wire('pages')->get('/'); if(!is_null($id)) $id = " id='$id'"; $out = "\n<ul$id>"; $parents = $page->parents; // This is where we get pages we want. You could just say template!=news-item foreach($rootPage->children('template!=post, template!=faq-item, template!=gallery') as $child) { $class = "level-" . count($child->parents); $s = ''; if($child->numChildren && $parents->has($child)) { $class .= " on on_path"; $s = str_replace("\n", "\n\t\t", treeMenu($page, $child)); } else if($child === $page) { $class .= " on on_page"; if($page->numChildren) $s = str_replace("\n", "\n\t\t", treeMenu($page, $page)); } $class .= " page-{$child->id}"; $class = " class='$class'"; $out .= "\n\t<li$class>\n\t\t<a$class href='{$child->url}'>{$child->title}</a>$s\n\t</li>"; } $out .= "\n</ul>"; return $out; }
  3. At fields Add New Field -> Type -> Checkbox and you can name it what ever you want and in template you can set up which checkbox to show Find 3 of the most recent children that have a red checkbox set, and display links to them: <?php $red= $page->children("red=1, limit=3, sort=-date"); foreach($red as $redcolor) echo "<p>Red Color: <a href='{$redcolor->url}'>{$redcolor->title}</a></p>";
  4. ignore it its not necessary dir rtl its only to show which link have a sub nav on it, this is in html but i have trouble to put in PW .
  5. I try to make one but i am not sure with this and i cant fix it , i have like this original navi <ul id="nav" class="dropdown dropdown-horizontal"> <li><a href="./">Gallery</a></li> <li><a href="./">Delta</a></li> <li class="dir rtl"><a href="#">Contact Us</a> <ul> <li><a class="active" href="#">Enquiry Form</a></li> <li><a href="#">Your Feedback</a></li> </ul> </li> </ul> and i need to put in processwire demo here http://demo1.sherbimeonline.com/ thanks,
  6. Here is how to do that if you have your own VPS or if you don't have just ask your web hosting for this First Step: run this command: pecl install json When it’s done you should have a json.so file in your PHP modules directory. This directory should be /usr/lib/php/modules/ Second Step: Add the json.ini file to /etc/php.d/ – to enable the extension add extension=json.so to this file Third Step: Restart Apache if you are using any sharing hosting maybe your PHP is older or something is wrong. or follow this link http://www.php.net/manual/en/json.installation.php
  7. Yes Ryan we are using VPS in Germany because we are in Europe and we need to have fast connection in link this is My VPS performance they are Xen Processor, they have a nice prices http://alvotech.de/vserver/compare/ 2048 MB RAM guaranteed 8192 MB RAM burstable 120 GB storage 2 fixed ip addresse unmetered bandwidth*** Control Panel for automatic installations, reboot, rdns & firewall Downtime 5 min in month lol only when i reboot dhe VPS, This servers are self manager you need to configure it , install cPanel or Direct Admin or other WHM ,
  8. If you have Dedicated or VPS also you can customize your MYSQL in server file in /etc/my.ini or my.cnf you can setup all things to work perfect server and speed it up, we have in one VPS 25k unique visitors and work perfect. # Enable it for vast improvement and it may be all you need to tweak. query_cache_type=1 query_cache_limit=1M query_cache_size=32M [mysqldump] quick max_allowed_packet=16M # interactive_timeout=180 interactive_timeout=100 # max_connections=500 just try to customize it for your server performances,
  9. I am trying to make a field for Uploading file like PDF DOC and other but the problem is when i try to use it in template is linking just to the file path "/file/assets/1/" not to the direct link where the file is i am using like this code <?php echo $page->fileuploadss->url; and how to display her description in template. Thanks is PROCESS WIRE 2.1
  10. Thanks Ryan for correction and alerting for SQL injection. but i am not using it now, i like to know best whey to create calendar event i don't like to use 2 DB i will use only PW DB for this i create a 'event' template and 'fields' before but only the problem is to show calendar format and dates in the page when i have any event to make date hover and when i click on it to send me to the event, this is my problem for now , if is not possible or need time to make it, it's not a problem you can leave it i will found any solution for this or i will try to fix it other whey. thanks for all support and i m sorry for taking your time.
  11. Hello Processwire forum, A like to know its possible to make something like calendar event for ProcessWire i create one but i need to put Data from other side not from processwire back end, i am using this code to add it, This is index.php where data is print demo http://arcadis.sherbimeonline.com/ <?php mysql_connect("localhost", "root", "password") or die (mysql_error()); echo "Connected to Mysql<br/><hr/>"; mysql_select_db("database_event") or die (mysql_error()); echo"Connected to Database<br/><hr>"; ?> <html> <head> <script> function goLastMonth(month, year){ if(month == 1) { --year; month = 13; } --month var monthstring= ""+month+""; var monthlength = monthstring.length; if(monthlength <=1){ monthstring = "0" + monthstring; } document.location.href ="<?php $_SERVER['PHP_SELF'];?>?month="+monthstring+"&year="+year; } function goNextMonth(month, year){ if(month == 12) { ++year; month = 0; } ++month var monthstring= ""+month+""; var monthlength = monthstring.length; if(monthlength <=1){ monthstring = "0" + monthstring; } document.location.href ="<?php $_SERVER['PHP_SELF'];?>?month="+monthstring+"&year="+year; } </script> <style> .today{ background-color: #00ff00; } .event{ background-color: #FF8080; } </style> </head> <body> <?php if (isset($_GET['day'])){ $day = $_GET['day']; } else { $day = date("j"); } if(isset($_GET['month'])){ $month = $_GET['month']; } else { $month = date("n"); } if(isset($_GET['year'])){ $year = $_GET['year']; }else{ $year = date("Y"); } $currentTimeStamp = strtotime( "$day-$month-$year"); $monthName = date("F", $currentTimeStamp); $numDays = date("t", $currentTimeStamp); $counter = 0; ?> <?php if(isset($_GET['add'])){ $title =$_POST['txttitle']; $detail =$_POST['txtdetail']; $eventdate = $month."/".$day."/".$year; $sqlinsert = "INSERT into eventcalendar(Title,Detail,eventDate,dateAdded) values ('".$title."','".$detail."','".$eventdate."',now())"; $resultinginsert = mysql_query($sqlinsert); if($resultinginsert ){ echo "Event was successfully Added..."; }else{ echo "Event Failed to be Added...."; } } ?> <table border='0'> <tr> <td><input style='width:50px;' type='button' value='<'name='previousbutton' onclick ="goLastMonth(<?php echo $month.",".$year?>)"></td> <td colspan='5'><?php echo $monthName.", ".$year; ?></td> <td><input style='width:50px;' type='button' value='>'name='nextbutton' onclick ="goNextMonth(<?php echo $month.",".$year?>)"></td> </tr> <tr> <td width='50px'>Sun</td> <td width='50px'>Mon</td> <td width='50px'>Tue</td> <td width='50px'>Wed</td> <td width='50px'>Thu</td> <td width='50px'>Fri</td> <td width='50px'>Sat</td> </tr> <?php echo "<tr>"; for($i = 1; $i < $numDays+1; $i++, $counter++){ $timeStamp = strtotime("$year-$month-$i"); if($i == 1) { $firstDay = date("w", $timeStamp); for($j = 0; $j < $firstDay; $j++, $counter++) { echo "<td> </td>"; } } if($counter % 7 == 0) { echo"</tr><tr>"; } $monthstring = $month; $monthlength = strlen($monthstring); $daystring = $i; $daylength = strlen($daystring); if($monthlength <= 1){ $monthstring = "0".$monthstring; } if($daylength <=1){ $daystring = "0".$daystring; } $todaysDate = date("m/d/Y"); $dateToCompare = $monthstring. '/' . $daystring. '/' . $year; echo "<td align='center' "; if ($todaysDate == $dateToCompare){ echo "class ='today'"; } else{ $sqlCount = "select * from eventcalendar where eventDate='".$dateToCompare."'"; $noOfEvent = mysql_num_rows(mysql_query($sqlCount)); if($noOfEvent >= 1){ echo "class='event'"; } } echo "><a href='".$_SERVER['PHP_SELF']."?month=".$monthstring."&day=".$daystring."&year=".$year."&v=true'>".$i."</a></td>"; } echo "</tr>"; ?> </table> <?php if(isset($_GET['v'])) { echo "<hr>"; echo "<a href='".$_SERVER['PHP_SELF']."?month=".$month."&day=".$day."&year=".$year."&v=true&f=true'>Add Event</a>"; if(isset($_GET['f'])) { include("eventform.php"); } $sqlEvent = "select * FROM eventcalendar where eventDate='".$month."/".$day."/".$year."'"; $resultEvents = mysql_query($sqlEvent); echo "<hr>"; while ($events = mysql_fetch_array($resultEvents)){ echo "Title: ".$events['Title']."<br>"; echo "Detail: ".$events['Detail']."<br>"; } } ?> </body> </html> This is Form to add event <form name='eventform' method='POST' action="<?php $_SERVER['PHP_SELF']; ?>?month=<?php echo $month;?>&day=<?php echo $day;?>&year=<?php echo $year; ?>&v=true&add=true"> <table width='400px' border='0'> <tr> <td width='150px'>Title</td> <td width='250px'><input type='text' name='txttitle'</td> </tr> <tr> <td width='150px'>Detail</td> <td width='250px'><textarea name='txtdetail'></textarea></td> </tr> <tr> <td colspan='2' align='center'><input type='submit' name='btnadd' value='Add Event'></td> </tr> </table> </form> and this is Mysql table SQL database table CREATE TABLE `eventcalendar` ( `ID` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , `Title` VARCHAR( 65 ) NOT NULL , `Detail` VARCHAR( 255 ) NOT NULL , `eventDate` VARCHAR( 10 ) NOT NULL , `dateAdded` DATE NOT NULL ) ENGINE = MYISAM ; its possible to integrate something like this in processwire or i need to use it manually from other site,
  12. I send it to u email 2silkworm[at]gmail(dot)com
  13. WTF its crazy i like this one, never see any vehicle like this !!!!!!
  14. Well perfect now its working nice >New yeah | 12/07/2011 - 12:15 pm $dateFormatted = date('d/m/Y - g:i a', $page->created); Thanks ADAMKISS always helpful
  15. Hello Processwire i have trouble with date in blog post, i like to put date when i post a article i am puting in template like this <?php $languages = $session->language; $children = $pages->get("/news/")->children("sort=-created, limit=5"); foreach($children as $news) { if($session->language) { $titulli = $news->{'headline_'.$session->language}; $shkurtimi = $news->{'body_'.$session->language}; }else{ $shkurtimi = $news->body_en ; $titulli = $news->headline_en ; } $shkurti = substr( $shkurtimi , 0, 250); echo " <h2> >$titulli | {$news->created} </h2> <p><a class='linkulajme' href='{$news->url}'>$shkurti</a></p> "; } echo "<ul class='MarkupPagerNav'>"; echo $children->renderPager(); echo "<ul>"; and in web look only like this: <h2> >$titulli | {$news->created} </h2> (>Viti i ri | [b]1310476537[/b]) PS, also i create a field datat and select date time but show only this date in page >Viti i ri | 12 / 31 / 1969 - 7:00 pm //edits: 14:07 adamkiss: Edited title & syntax formatting. Please use BBCode's [ code ] tag (without spaces) to format PHP (or other) code. Also, use as descriptive title/subject as possible. 15:00 adamkiss: added solved tag
  16. Thanks Ryan , for website i am making google or other search engine is not a problem but if you have a solution for this yes you can describe maybe this will help for others and me too to work more with search engine, Thanks for feedback and your help,
  17. RewriteCond %{HTTPS} off RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC] RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] this is not necessary, work and with out it only RewriteBase / need to be on to work PW in 1and1,
  18. Here i like to share with you site demo made with PW 2.0 in 2 language without tree sort, everything is made with fields, search works fine when you are in English language search will searching only English terms , and same for other language! i try to translate every word in site, maybe i forget any http://www.sherbimeonline.com/ Thanks to Ryan and Adamkiss,,
  19. Yes this code is for if someone type site.com to R to www.site.com RewriteCond %{HTTPS} off RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC] RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] but with out this doesn't work in 1&1 or work just first page when you try to go to other pages u will got error 500 Error 500 - Internal server error An internal server error has occurred! Please try again later. RewriteBase / this line is in processwire htaccess but is off and need to be on for 1and1 hosting, in other servers work without it, RewriteRule ^(.+) - [PT,L]
  20. If someone is using 1and1 hosting this is my solutuion to work Processwire in 1and1 AddType x-mapp-php5 .php .html .htm AddHandler x-mapp-php5 .php .html .htm RewriteCond %{HTTPS} off RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC] RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteBase / RewriteRule ^(.+) - [PT,L]
  21. This is really amazing perfect lovely now process wire for me is full 1.2.3.4.5 language support, thanks Adamkiss for this fast support i make like this and work perfect <?php // Output navigation for any children below the bodycopy. // This navigation cycles through the page's children and prints // a link and summary: $languages = $session->language; if($page->numChildren) { echo "<ul class='nav'>"; foreach($page->children as $child) { echo "<li><p><a href='{$child->url}'>".$child->{'headline_'.$session->language}."</a><br /><span class='summary'>".$child->{'body_'.$session->language}."</span></p></li>"; } echo "</ul>"; } and language settings is <?php $languages = array('en', 'al'); // check if the current page's URL ends with a language if(in_array($input->urlSegment1, $languages)) { $session->language = $input->urlSegment1; } if($session->language) { $body = $page->get("body_" . $session->language); $headline = $page->get("headline_" . $session->language); $sidebar = $page->get("sidebar_" . $session->language); } else { $body = $page->body_en; $headline = $page->headline_en; $sidebar = $page->sidebar_en; }
  22. Hello i am making a web with 2 different language and i am using like this code from Ryan, <?php $languages = array('en', 'al'); if(in_array($input->urlSegment1, $languages)) { $session->language = $input->urlSegment1; } if($session->language) { $body = $page->get("body_" . $session->language); $headline = $page->get("headline_" . $session->language); $sidebar = $page->get("sidebar_" . $session->language); } else { $body = $page->body_en; $headline = $page->headline_en; $sidebar = $page->sidebar_en; } its possible to make changes and from children pages <?php // Output navigation for any children below the bodycopy. // This navigation cycles through the page's children and prints // a link and summary: if($page->numChildren) { echo "<ul class='nav'>"; foreach($page->children as $child) { echo "<li><p><a href='{$child->url}'>{$child->title}</a><br /><span class='summary'>{[b]$body[/b]}</span></p></li>"; } echo "</ul>"; to change and other language ? when i switch from AL to EN $body = $page->get("body_" . $session->language); this is for page , if any possibility for child. .
  23. Thanks Ryan for now i am just working with other field for title and make me easy to make 2 different language and look nice and easy to manage it,
×
×
  • Create New...