Modifying OSSN-Site-Pages there is an bug

Fatih Bayram Posted in Component Development 9 years ago

I doesn't know if this topic are correct for the discussion.

I want add new pages to my site and this is not possible over the admin menu so I take a view to the files in OSSN-Site-Pages

I think I made all thing correct but when I enter over the admin menu something to the page this will not showed in the front end.

Can anybody help me to fix it? Here is the modified component http://www.file-upload.net/download-11293370/OssnSitePages.zip.html

enter image description here

enter image description here

Replies
Turkish Fatih Bayram Replied 9 years ago

After few days I fixed my modified componet yeees man. :D

The affected file was ossn_com.php

Turkish Fatih Bayram Replied 9 years ago

So I did every thing wrong? Zet Man can you please help me add a new page? Thanks

German Michael Zülsdorff Replied 9 years ago

I wouldn't want to drive you crazy - my idea was making you understand what you're doing. :)

Because just copy/pasting some code without reading the manual and no understanding may lead to even more dangerous results than just 'not working'. The following switch will handle 4 pages now. If for whatever reason an unknown page name arrives here, the default action will come true, and that means: do nothing.

   switch ($settings) {
        case 'terms':
        ...
        break;
        case 'about':
        ...
        break;
        case 'privacy':
        ...
        break;
        case 'contact';
        ...
        break;
        default:
        break;
    }
Turkish Fatih Bayram Replied 9 years ago

Zet Man

I understand you I tried to fixed with they ways your offered me. Can you please fix the file settings? Please man I get crazy :D

German Michael Zülsdorff Replied 9 years ago

A switch is meant to handle different cases depending on a given condition. Let's assume our program is a driver's helpdesk. The programmer has prepared several answsers, but of course he cannot handle every available drug. That's why he needs a default answer to be printed out for unknown cases. Then the switch will look like:

switch ($drug) {
case 'beer':
echo 'drink slowly and try to concentrate';
break;
case 'amphetamine':
echo 'check money and gasoline first', you'll probably drive 48 hours or more';
break;
case 'lsd':
echo 'fasten seatbelt but keep your hands off ignition';
break;
default:
echo 'sorry, no idea.';
break;
}

You may program as many cases as you like, but there can only be one default answer.

Turkish Fatih Bayram Replied 9 years ago

Zet Man

why will the code not executed ? I viewed few times to the code but all thing looks right and dont works -.-

German:
Zetman wieso wird der Code nicht ausgeführt ? Ich habe mir den code mehrmals angesehen ich finde es nicht. Bitte hilf mir danke,.

German Michael Zülsdorff Replied 9 years ago

Hi Fatih,

consult http://php.net/manual/tr/control-structures.switch.php

and you'll find that more than one default statement doesn't make sense in a switch. Your code below in settings.php will never be executed this way. :)