Dynamic Site Design - Classnotes

Last Updated - 5/04/06

Week 2

To Archive Local Files

cd ~/sites
tar -czvf [backup].tar.gz ./rdavidson

The "backup" file will be created, then when you open the file it will explore to create joffray.

In broswer : http:/localhost/~student/rdavidson

student$ cd~/Sites
student$ cdchmod -R 777 rdavidson

To install:

To set file permissions

student$ cd ~/Sites
student$ chmod -R 777 rdavidson
chown -R www:www rdavidson

To create a database:

student$ cd /usr/local/mysql/bin
./mysql -u root
mysql> create database rdavidson;
show databases;

exit;

Make sure to click 'Drop Existing Tables'


Host: hp3.ccom.net
username: rdavidson
password: ***
database: rdavidson

Then return to the localhost and rename the installation folder to something else...refresh your browser and voila!

Move Database from internet(HP3) to Local, to get past the installer:

R106-08:/usr/local/mysql/bin student$ cd ~/Sites/rdavidson
R106-08:~/Sites/rdavidson student$ ls   Show what's in the folder
1.installation                          htaccess.txt
CHANGELOG.php                           images
COPYRIGHT.php                           includes
INSTALL.php                             index.php
Joomla_1.0.8-Stable-Full_Package        index2.php
Joomla_1.0.8-Stable-Full_Package.tar.gz language
LICENSE.php                             mainbody.php
administrator                           mambots
cache                                   media
com_phpmyadmin262lite.zip               modules
components                              offline.php
configuration.php                       offlinebar.php
configuration.php-dist                  pathway.php
editor                                  rdavidson.sql
globals.php                             robots.txt
help                                    templates
R106-08:~/Sites/rdavidson student$ /usr/local/mysql/bin/mysql -u root rdavidson < ./rdavidson.sql


Week 3

Once the spreadsheet is created then you export from excell as a CSV (comma seperate values) that's how you'll get this into mysql.
At least 6 records. *make sure you leave the first column open for the ID. This will be created by mysql.

To check if mysql is active type this in the terminal

R106-08:~ student$ /usr/local/mysql/bin/mysql rdavidson

When you activate your localhost mysql database you need to alter the configuration.php file in the local database folder.

configuration.php
$mosConfig_offline = '0';
$mosConfig_host = 'localhost';
$mosConfig_user = 'root';
$mosConfig_password = '';


Here is a screenshot of the phpmyadmin control panel screen once you click on the export tab. These settings will export your database into a file which you can backup using the terminal.


Week 4

Checklist for beginning class

  1. Make sure your files are there
    tar -xzvf rdavidson.tar.gz
  2. Make sure localhost is running
    http://localhost/~student
  3. Make sure mysql is running
    /usr/local/mysql/bin/mysql -u root rdavidson
  4. Check if your database is ready
    mysql show databases;

To give write permission to the localhost

chmod -R 777 rdavidson

To change the owner of www

chown -R www:www rdavidson

To archive your database folder

tar -scvf rdavidson042706.tar.gz ./rdavidson


Week 5

Module vs Component

Module - is more periferal, (a search box, sidebar, latest entry, pull-down menu) Module does something with the data contained in a component. An extension of a component that gives useability.

Component - collection of data (database).

Talk about the names of the files and their uses. You need to know what each file is for before you use it. We need to follow the naming convention because the system has already been writen and we need to fit to it. It's important that these are named exactly. In

 admin_schools_html.php or admin_schools.php 
the "schools" portion is what we change. The first is HTML, while the second is logic.
  schools_class.php
starts an object that extends the joomla class and is referable as far as the functions inside of it.
 install_schools.hp
simply displays the message after install.
 schools.php
is the public output...what is seen on the web. The public display of the data.
schools.xml
has all of the install information. It will know based on the xml file where to put the schools.php file. It will also have the initial data and sql.

toolbar_schools_html.php and toolbar_schools.php

uninstall_school.php
displays a message when you uninstall.

    How to convert the schools component into a component you can backwards engineer.

  1. In JoomlaXplorer: rdavidson>administrator>components
  2. copy com_schools > rename to com_[your component name]
  3. go into copied component com_cityofficals
  4. change name of files to match your name
  5. go into public > components
  6. duplicate com_schools and rename
  7. copy up levels into the administrator components section into your component folder
  8. once you have them changed test by changing the URL to test your component
  9. Then go into the administrator component and edit to customize your own component.

Homework - Create a web template in photoshop, Read Daily Message Tutorial (week4 Turtle Project)


Week 7

Add a published field to your component(database).

  1. Add A Published Field ->
  2. phpMyAdmin -> add published field -> add field at the end
    published tinyint default 0 
  3. export (not as a file) -> copy and paste the published line into your sql query in your component XML (installer config)
  4. also add var published to component class file

To Install a component

  1. Create your tables and fields in phpMyAdmin -> bottom of the main page
  2. Add your field names
     id INT 11 NULL AutoIncriment [set as key]
  3. Make sure to set up a published field as shown above
  4. insert your data from your csv file
  5. Copy the files from the schools [component].php from the public folder into the admin component folder
  6. Rename all the files to match your component name ie [admin.furniture.html.php] etc.
  7. Export your database data and copy and paste it into your XML file (be sure to keep sql syntax using query and removing all semicolons.
  8. Be sure to keep the file names lowercase in the XML file since they are case sensative.
  9. Once you're done, rename your component folder com_[component]_org
  10. Then take the folder you just renamed and zip it up, make sure you don't have the download box clicked. Name the zip file 'com_[component]'.
  11. In Joomla, go to installers > components and point to your zip file. Click unzip&install. Then you troubleshoot :)
  12. Once you have it installed, edit your admin.[component].html.php to include all your data fields. That's in for the install.


This is a photo of what you copy after you export your database. Remeber to remove the ';' at then end and add a 'query' tag at the beginning and end.


Week 8

PHP FIX

The error with the php was caused by two problems. One was that the php version has changed which caused the second problem. In the new version of php a security feature was added . This caused the global variables to no longer be availible by default. In order to access the global variables you need to pull them useing the REQUEST method built into mos. The code is:
$id = mosGetParam($_REQUEST, 'id', '');
You need to add this code on line 26 of your admin.mycomponent.php file. Once you do this you can access the $id variable and publish your component.

this

PUBLIC PHP FILE


Week 9

How to edit a module within your template