Hi,
I did not care any notices from php in a long times as a php developer . but themeforest require so I must find a simple way to solve the notices.
My suggest is build a function that will not echo “un-isset” var. something like this

function prevent_notice($var){
if(isset($var)){
echo $var;
}
}

so you can ignore any notices from any un-isset var without set init them.

The issue is if I want to prevent notice of an var like $user[‘name’] , then php will notice that the offset ‘name’ must created!

So anyone can know how to know array and key of $var when we use an var like $user[‘name’] inside an function.

why not? I just call them in theme options. which only use once. it’s simple the code.
normal way (which I know)
- set init data for var
- echo var
better way
- declare prevent_notice function
- call function
so we can ignore a large init vars code lines.
let me know better way?

the profit of this function that you will never need to init any data before echo it. which is very popular and a big problem in theme options. I wanna to keep my code clear. no more waste code lines for init vars.

Because if you are giving the option of a logo here, you should definitely provide an alternative. It isn’t a good practice to leave the user without a logo if he doesn’t set it.. This should be the case for all theme options.

Because if you are giving the option of a logo here, you should definitely provide an alternative. It isn’t a good practice to leave the user without a logo if he doesn’t set it.. This should be the case for all theme options.

thanks for your code. if the option alway have real init so I never care for notice problem . because I’m alway set init for it , so the notice’s never come. I just don’t happy with init value for empty var

Post Reply

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody