Website Development Prices

Search Blog

Wednesday, March 30, 2016

Prosledjivanje argumenata po referenci (Passing arguments by reference)

Kada se funkciji prosledjuje argument, podrazumevano se prosledjuje po vrednosti. To znaci da se u funkciju salje kopija podatka a ne sam podatak. 

Ako zelite da promenite originalnu vrednost koju ste prosledili u funkciju, na primer, ako zelite stringu koji je usao u funkciju dodate neki tekst:

Primer:

<?php

$string = "Ja volim ";

dodaj_tekst($string);
echo $string;

function dodaj_tekst($tekst)
{
$tekst .= "motore.";
}
?> 

Rezultat:

Monday, March 21, 2016

Simple website design and code-Part 3

In previous two articles we designed home page and we sliced it and now we are going to code it.


Step 1 - Setting up files and folders

You are supposed to have folder first-website. In that folder you have another folder images, with images from previous article and first-website - Copy.xcf file. 



Rename this file to first-website.xcf



Open this file in GIMP, we'll need to pick up fonts, colors... In your first-website folder add two files - index.html and style.css. Open the editor of your choice, press CTRL+N twice to create new files. 

Saturday, March 19, 2016

Simple website design and code-Part 2

Slicing the GIMP design (home page)





In the previous article we created home page and now we are going to slice it.

Step 1 - .xcf file

Make copy of your
.xcf file.



Step 2 - Header

We will stretch it out across the whole screen. We are going to take slice of header and repeat it across the screen again and again.

a) Open the copy of your
.xcf file - first-website - Copy.xcf. Remove all guides from document. Select Move Tool (M),



hover over guide (red line), click (green line) and move left to the ruler to remove vertical guides. If you have any horizontally guides, hover over them, click and move up to the ruler to remove them.

Definisanje podrazumevanih argumenata funkcije (Defining default arguments of function)

U prethodnom clanku videli smo kako mozemo da funkciji prosledimo podatke.

Primer:

<?php

ucim_php("Ja ucim PHP.");

function ucim_php($tekst)
{
echo $tekst, "<br />";

}

?>

Rezultat:

Ja ucim PHP.

Ako ovoj funkciji zaboravite da prosledite argument i pozovete je 

<?php

ucim_php();

function ucim_php($tekst)
{
     echo $tekst, "<br />";
}

?>

dobicete poruku o gresci

Friday, March 18, 2016

Simple website design and code-Part 1

We are going to design and code simple website. Part 1 will be GIMP design of home page, Part 2 Slicing GIMP design (home page) and Part 3 will be code.


Step 1 - What you need

  • GIMP
  • A code editor (Notepad++, Sublime Text 2 or 3, or any other)
  • Basic understanding of how HTML works, basic syntax and tags
  • Basic understanding of CSS, also you should understand how selectors work and be familiar with basic properties.
  • A browser Chrome, Firefox ...
Step 2 - What we are making

We will make a very simple home page, with four basic elements: header, content, sidebar and footer.

Tip: when you make some changes to the document, press CTRL+S to save document.
Step 3 - Let's start

Open up new GIMP document (CTRL+N), for example, 1100px by 1200px.



Save file, for example, first-website.xcf.

Tuesday, March 15, 2016

Prosledjivanje nizova u funkciju (Passing arrays in function)

Pored podataka koji predstavljaju obicne promenljive, u funkcije mozete da prosledite i nizove. 

Primer: kreiracemo funkciju stampaj_niz, koja stampa sadrzaj niza.

<?php

$motor[0] = "suzuki";
$motor[1] = "honda";
$motor[2] = "kawasaki";
$motor[3] = "yamaha";

stampaj_niz($motor);

function stampaj_niz($niz)
{
for ($indeks = 0; $indeks < count($niz); $indeks++) {
echo "Motor $indeks: ", $niz[$indeks], "<br />";
}

}

?>

Rezultat:

Monday, March 14, 2016

Prosledjivanje podataka funkcijama (Passing data to functions)

Funkciji mozete da prosledite podatke pomocu liste argumenata. To je lista naziva promenljivih, koji su odvojeni zarezima.

function ime_funkcije([lista_argumenta...])
{
[iskazi];
[return vracena_vrednost];

}

Primer: ako zelite da prilagodite navigacioni meni koji smo napravili u prethodnom clanku, na primer, zelite da dodate neki tekst i oznaku autorskih prava. To mozete da uradite tako sto cete u funkciju poslati te dve stavke. Ako bismo te dve stavke u telu funkcije oznacili kao $tekst i $autorska_prava, onda bi funkcija mogla da izgleda ovako:

Saturday, March 12, 2016

Kreiranje funkcije (Creating function)

Sintaksa za kreiranje funkcije:

function ime_funkcije([lista_argumenta...])
{
[iskazi];
[return vracena_vrednost];

}

Primer: na svim vasim web stranicama postoji navigacioni meni  sa hiperlinkovima koji se nalazi na dnu strane. Umesto da sav kod koji je potreban ubacujete na svaku web stranicu, mozete da napravite funkciju, koju mozete nazvati navigacioni_meni, da ona to radi umesto vas. Iskazi koji postoje u ovoj funkciji ce se izvrsiti u trenutku njenog poziva. Dodacemo echo iskaze koji salju HTML kod za navigacioni meni i hiperlinkove nazad do pretrazivaca. "&nbsp" u HTML kod ubacuje prazne karaktere da bi linkovi bili odvojeni.

Kako postaviti pozadinsku sliku sa iseckom slike (How to set background image with slice image)

Pitanje: kako postaviti pozadinsku sliku sa iseckom slike?

Resenje: svojstva background i background-repeat.

Primer:

HTML kod

<!DOCTYPE html>
<html>
<head>
<title>Pozadinska slika sa iseckom slike</title>

<meta charset="UTF-8"/>
<meta name="description" content="Description that search reads" />
<meta name="keywords" content="page keywords, keywords" />
<meta name="author" content="Marija Rikic">
<link rel="icon" type="image/png" href="images/favicon.jpg">
<link rel="stylesheet" type="text/css" href="style.css">
</head>

Friday, March 11, 2016

Upotreba operatora za rad sa nizovima (Using the operators to work with arrays)

Operatori za rad sa nizovima:



Primer: proveravamo da li dva niza imaju iste elemente.

<?php

$japan["suzuki"] = 15;  
$japan["honda"] = 19; 
$kina["shineray"] = 11; 
$kina["thumpstar"] = 17; 

echo "\$japan: ";
print_r($japan);
echo "<br />";
echo "\$kina: ";
print_r($kina);
echo "<br />";

$motori = $japan + $kina;
echo "\$motori: ";
print_r($motori);
echo "<br />";

if ($japan == $kina) {
echo "\$japan ima iste elemente kao \$kina<br />";
} else {
echo "\$japan nema iste elemente kao \$kina<br />";
}

?>

Thursday, March 10, 2016

Kako da promenite ili uklonite znakove za nabrajanje (How to change or remove bullets)

Pitanje: kako da promenite ili uklonite znakove za nabrajanje?

Resenje: svojstvo list-style-type.

Primer:

HTML kod

<!DOCTYPE html>
<html>
<head>
<title>Kako da promenite ili uklonite znakove za nabrajanje</title>

<meta charset="UTF-8"/>
<meta name="description" content="Description that search reads" />
<meta name="keywords" content="page keywords, keywords" />
<meta name="author" content="Marija Rikic">
<link rel="icon" type="image/png" href="images/favicon.jpg">
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>

Wednesday, March 9, 2016

Kako da dobijete sva velika ili sva mala slova u tekstu (How to get all the capital or lowercase letters in the text)

Pitanje: kako da dobijete sva velika ili sva mala slova u tekstu?

Resenje: svojstvo text-transform.

Primer:

HTML kod

<!DOCTYPE html>
<html>
<head>
<title>Kako da dobijete sva velika slova u tekstu</title>

<meta charset="UTF-8"/>
<meta name="description" content="Description that search reads" />
<meta name="keywords" content="page keywords, keywords" />
<meta name="author" content="Marija Rikic">
<link rel="icon" type="image/png" href="images/favicon.jpg">
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>

Kako da promenite visinu teksta izmedju redova (How to change the height of the text between the lines)

Pitanje: kako da promenite visinu teksta izmedju redova?

Resenje: svojstvo line-height.

Primer:

HTML kod

<!DOCTYPE html>
<html>
<head>
<title>Kako da promenite visinu teksta izmedju redova</title>

<meta charset="UTF-8"/>
<meta name="description" content="Description that search reads" />
<meta name="keywords" content="page keywords, keywords" />
<meta name="author" content="Marija Rikic">
<link rel="icon" type="image/png" href="images/favicon.jpg">
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>

Sunday, March 6, 2016

Grouping elements

HTML has special elements that serve to group other elements. Thus it is made possible to group logically related elements, which will be located in the same part of the page, to be positioned along and the like. There are tags that serve to surround and other types of elements such as:

  • <div> - element which divides ie. grouping other HTML elements. The most commonly is used to define the layout of elements on the page - layout.
  • <span> - an element which by default does not affect the position of the elements that surround. It is mainly used so that elements that are contained in it, assigns some look.

The difference between <div> and <span> tags is that a div (division) element is block line (which is basically equivalent to having a line break before and after it) and is used to group larger pieces of code  and a span element is inline and usually used for a small piece of HTML inside a line (for example, inside a paragraph).

Prolaz kroz visedimenzionalni niz (Looping through a multidimensional array)

Ako imate niz sa dve dimenzije, prvo promenite prvi indeks, a onda drugi u unutrasnjoj petlji. Ovo mozete uraditi pomocu ugnjezdenih petlji.

Primer:

<?php

$cene_motora[0] [] = 2500;
$cene_motora[0] [] = 2350;
$cene_motora[1] [] = 3700;
$cene_motora[1] [] = 3550;

for ($spoljni_indeks = 0; 
$spoljni_indeks < count($cene_motora);
$spoljni_indeks++) {
for ($unutrasnji_indeks = 0; 
$unutrasnji_indeks < count($cene_motora[$spoljni_indeks]);
$unutrasnji_indeks++) {
echo "\$cene_motora[$spoljni_indeks][$unutrasnji_indeks] = ", 
$cene_motora[$spoljni_indeks][$unutrasnji_indeks], "<br />";
}

}

?>

Friday, March 4, 2016

CSS: Fade in neon glow tekst efekat (Fade in neon glow text effect)


HTML kod

<!DOCTYPE html>
<html>
<head>
<title>CSS: Fade in neon glow tekst efekat</title>
<meta charset="UTF-8"/>
<meta name="description" content="Description that search reads" />
<meta name="keywords" content="page keywords, keywords" />
<meta name="author" content="Marija Rikic">
<link rel="icon" type="image/png" href="images/favicon.jpg">
<link rel="stylesheet" type="text/css" href="css/style.css">
<script type="text/javascript" src="js/jquery-1.11.3.js"></script>
<script>
$(document).ready(function() {
$('body').hide().fadeIn(5000);
});
</script>
</head>

Kreiranje visedimenzionalnih nizova (Creating multidimensional arrays)

Do sada smo radili sa jednodimenzionalnim nizovima. Moguce je napraviti i nizove sa vise skupova kljuceva. 

Primer: mozete da skupove cena motora za razlicite motore sacuvate na sledeci nacin.

<?php

$cene_motora["suzuki"] = 2500; 

$cene_motora["lifan"] = 3700;

?>

Ako imate jos jednu cenu motora, mozete da dodate drugi indeks koji oznacava broj motora.

Nastavak primera:

<?php

$cene_motora["suzuki"] [1] = 2500;
$cene_motora["suzuki"] [2] = 1900;
$cene_motora["honda"] [1] = 3700;
$cene_motora["honda"] [2] = 2550;


print_r($cene_motora)

?>

Tuesday, March 1, 2016

Kako da podvucete naslove (How to create underline for headings)

Pitanje: kako da podvucete naslove?

Resenje 1: svojstvo text-decoration.
Resenje 2: svojstvo border-bottom.

Primer 1: ako koristite svojstvo text-decoration, boja podvucenog naslova bice ista kao i boja fonta.

HTML kod

<!DOCTYPE html>
<html>
<head>
<title>CSS - Kako da podvucete naslove</title>

<meta charset="UTF-8"/>
<meta name="description" content="Description that search reads" />
<meta name="keywords" content="page keywords, keywords" />
<meta name="author" content="Marija Rikic">
<link rel="icon" type="image/png" href="images/favicon.jpg">
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>